{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "from mpl_toolkits.mplot3d import Axes3D\n",
    "import sympy as sy\n",
    "sy.init_printing() "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# <font face=\"gotham\" color=\"purple\"> Null Space </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The <font face=\"gotham\" color=\"red\"> null space </font>, denoted <font face=\"gotham\" color=\"red\">$\\text{Nul}A$</font> is the solution set of a homogenous linear system $Ax=0$. \n",
    "\n",
    "Null space is a subspace of $\\mathbb{R}^n$, why? Consider a linear system.\n",
    "\n",
    "$$\n",
    "3x_1-x_2+x_3 = 0\\\\\n",
    "x_1+2x_2+3x_3= 0 \n",
    "$$\n",
    "\n",
    "The augmented matrix is \n",
    "\n",
    "$$\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "2 & -1 & 1 & 0\\\\\n",
    "1 & 2 & 3 & 0\n",
    "\\end{matrix}\n",
    "\\right]\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Before solving the system, we have already known there is no unique solution since a free variable exists."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAN0AAAAzCAYAAAATig3oAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAJH0lEQVR4Ae2djXXUOBDHCS8F8EIHSQfhqADo4OAqADqAlwp40AFHBRx0AFcBRzogHRDSAff/KRo/f3/IXq+9Hr2n3bWkGc2MNJqxNPYe/f79+86YdHR0dK8OXnhv6sq9bBkS8HHb3zjc7dO1BuiT8uOGtt9V/quU3za09eLlSOBTacwYQ8o8JUiARUz5C99d4J1KJyQMxBdZrq8tyJ6o/iiXX7a09aoFSEBjVRgzkeRjNmJcJE88u9f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7uTMY5lCd1YKENGlPhBYfLH56oMEtnT7VOeY9l1qyOTluNR98T1CHfeJnLfWETQMYMLxKDFs72gtJJg3EvMfH2Kj79HJeEE3ykOutpZWNWjlvs/lmQgMu9II6lXJgxCy80MksHcbwQ0yqnInbJ8XNT8bhEPC73ZY0K59G4z8HI5JUunMrLFE6peL3j55Ylo9VT43Jf1hASRJDtzmZKJy1kdUQTU7dEK2wK52Zf+FoRxowFLvcZhd3RVdz1pFX28qXjEgwn7QQkv9bA2T1Zqcngy874ucEYewKIj2C91dzOIOd80S3bzPvsf29y7zk8W2lGBEvhPx+PpFwF5jVRfqmA7dHOmDcA1Z73RXB+EbZDKfO0PgloHDmH4v2PO4uHXZ9UxlEsmXKrxo7lmeSabRpm7mUOPcrGIzi2w5ir8p8uAZfAAAmYlcsUDtiK0kkj8T05QriggSeXgEtguASilcPSPS9DV5QuNqAh/5N8Wgbwa5eAS6CXBLifx12v7I3UKp0aYun473EAPbkEXAIDJCBjhd7wJyPhMLwMWqt0NBIAEeRXQpDy7FC5H792CWxCAtIXzuR4/Kfx6K1R6ZBQBOT9Il3R3zwPFQKm7XsTEl4xkzZO9i1WfONs5HhKludCwV7IozZUrUoHoBSPLeSnQtgWqcJpO0cNlt06ShgLT7hANl58+5iNGDAWL4F/UOZPRyv3cXnU/wPJpmlwE9kPFgAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left( \\left[\\begin{matrix}1 & 0 & 1 & 0\\\\0 & 1 & 1 & 0\\end{matrix}\\right], \\  \\left( 0, \\  1\\right)\\right)$"
      ],
      "text/plain": [
       "⎛⎡1  0  1  0⎤        ⎞\n",
       "⎜⎢          ⎥, (0, 1)⎟\n",
       "⎝⎣0  1  1  0⎦        ⎠"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Aug = sy.Matrix([[2,-1,1,0],[1,2,3,0]])\n",
    "Aug.rref()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$x_3$ is a free variable, the solution set is\n",
    "\n",
    "$$\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "x_1 \\\\ x_2 \\\\ x_3\n",
    "\\end{matrix}\n",
    "\\right]=\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "-x_3 \\\\ -x_3 \\\\ x_3\n",
    "\\end{matrix}\n",
    "\\right]=\n",
    "x_3\\left[\n",
    "\\begin{matrix}\n",
    "-1 \\\\ -1 \\\\ 1\n",
    "\\end{matrix}\n",
    "\\right]\n",
    "$$\n",
    "\n",
    "which is a line passing through $(0, 0, 0)$ and $(-1, -1, 1)$, a subspace of $\\mathbb{R}^3$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Consider another example, suppose we have an augmented matrix"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPYAAABLCAYAAABDRnpjAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAM90lEQVR4Ae2d/ZEUNxrGd13++2oNVfe/1xkYiADIwNgRcM7AFBFQOAMgAgMZLI6AgwwggKs62LoE9p5fo3dKq1F/7Iy6pZ55VaXpbqlHevToffXd0unJycnPsh9kc+bt1dXVo5yHuzkDzkA9Bk5PTz8p9vMcAuns6feRx5+65+XYfI4f/N4ZcAaaYeB5BslDuf2Ce6zYL6TprsgZttzp+BhQjUht+ED2tfTisjUGhOllikmYcdpS7PS9os+BqN9DoGe6QtxzAXxXNKI9AhPGtBT8S/g+7hFkM39V2uhyvZG9U0NQa8e/Q0bA1wussOf+fikef8h5lHKL5PG/CvMnWfRlUuUb19il8GyFI4Ao8hOBMsU+kdu/5Hah6yO5v93604IOwkAhcyH7u7B0BY3cUAIshK7SKA3w/kr2i+xd2WyfTO6zmNrx75moe/o/hTqKBH+xoSZ/EjuUvhd3jHs9M90IXH7Q9aHcJik3JdOV7Ln+cDKHVdh/h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8ZPBqVvC15e+0SbboHTs70mT+8c4GGHlJBBqbw5xp9aepa+91nwHt/iBslzemduoPBZVbAGiNG5yU32Y2sGg2PeUrnQuvhs/CO4csWsr7naIYq+/3NW/cyV8V7ILF/3ZKkbcIIQUipcpALl9lj8KbTVQ+krt59r5TpcFDKkxvvAfNMUUWxmFsPdtqt9k/3SQGXlKACFwi0Sl9Svu8u+bDRgLupQ/Yxi5QoWacAt3qUinhCNc1DzYvu4Ail8VY186Gsh3KpLcACMtMxYkbRWWaVq+Sx12eSbz9D/A8PHBi8jixgDEKJBd4q34H4QSW9t0XMcgxL2tjKtd6AALDN3y0QQj4xZMeY02KeP/NXC/SL6LFyrCL8pLG3ik20Xcv8peW+HZx0mpGhsFRrnJsNRUaw6mQPZ9psBSGDR/Md3CC10R0CqngaAYwvQ84AITTTWa5rMNShHJVCN8zGMjiK90jbsMq/oIJPC7dL5TOz9V3NYkv6fn++J0kj7RS6cJzXpe+sZrK0EF240z4AzAgAqBbgZHenxapCnutDoDzkBbDLhit5UfjsYZKMKAK3YRGj0QZ6AtBlyx28oPR+MMFGHAFbsIjR6IM9AWA/F0FwvzU3RvNcLWwnxoisufnYGjZkC6ypLc8z4SUGymuGyRfvqeT3+ljPizM9AGA7mVaRtk/wfx6u2R93/CIQAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}-3 & 6 & -1 & 1 & -7 & 0\\\\1 & -2 & 2 & 3 & -1 & 0\\\\2 & -4 & 5 & 8 & -4 & 0\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡-3  6   -1  1  -7  0⎤\n",
       "⎢                    ⎥\n",
       "⎢1   -2  2   3  -1  0⎥\n",
       "⎢                    ⎥\n",
       "⎣2   -4  5   8  -4  0⎦"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Aug = sy.Matrix([[-3,6,-1,1,-7,0],[1,-2,2,3,-1,0],[2,-4,5,8,-4,0]]);Aug"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAVQAAABLCAYAAAAvZX9PAAAACXBIWXMAAA7EAAAOxAGVKw4bAAARpUlEQVR4Ae2dW44UORaGqxDPI6aR5n2KHUCzAugd0PQKethBI1bQoncAvYIe2AH0ChhqB7CAkQZK8zwS839RPlGOSMfNGRdn5rEUGRG+HB//tn8fOyKc59++fTsb487Pzz8q3nPFf5+Kr/D78idOyr1Vuh9TAe7nCDgC+Qio331S6ouUBPW585S/+41DQNiC6zsdD4Tl1ZhUt8dEkuBXive5i0xbMn7TPZUcu8/xjV87Ao7AbAi8TEj6QX5PEv7uNQEB8d1ncd9bJfldxyiD8FyJerOQQCoGgX/vY2nFMwv1Hor0CvVAR8ARWAwB9cV/SPgr9UO3UGdAWXh+lRhm56+HxPVaqBJ0RwIgU4SNMnmHMrTwQMBvdD/anLa0W52lM1OA5yH/73X+wr2wuQx+i56Uv1kj/1FG93S8VN4HNXiVWO+hXp+FyqPNU89gm1zeCvFWOx1Dva8G1jIZYZ2+Uz28H+xvinDWdUgIhPexKzz2VzwsVMzdi9g/vlYYjRWZLCGw3kr8O3GcUq+lJ53sTayf7iE4yvA49l/iWnmA1xOTrWuwrNbPzK/Uc9C1yHoPumHN1f1Aflh41GuNdxy+5rV0mFzvpv+aeh57XsKU9vtuqJx1I2pHVGIjyFFkEcXvJNQ4D8X/RcchESqA7pC//JgOfI3LNve15NPBP7Xlyg9CH6zkdrot76VvUfUe6VOTp/wYrGibo4yJpfBU/ln1HtJJrZtBwq/3w0KYYlANDrK3FKnLMdW/VEUUMe3pUnJF/8fK66vMfjpb7MDnTpg2xv5zXjPlSC0rfJD/44ROc+Z97LLA9SocVVnV5rkvwXm9l1AL0kFtgqU1+rotuyU1SxKqOigPorBQbb0wmfjEPAGTNx26OlubaOeEBzJnvbbtTBfC3WUggMGg46+cL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B35kNt0gUwrdJlT+iwVn5uz13Qy/YnKb6qem9eZ384LsDHmOFeG6jUVqN17J2O1q2/QpWfeSdWuieJJ3NotvTPdBokGoqkSb9mftYTgCWuRfJOKZhdpY4E3EW9LLdctHt2TshkpVsu4l6zaE6zGHY3DydH/QQgWEX3Uw7TcWxm8uhwWc+njggfz561qzYufKb4oc120KWs24JWPX1HT3rmTdS9ZtF8kT8AnTfZZE0/u8isR2PjVVZD6nepMK6/JTfDIh3dCnp2zE2v709Cvpu2Sv5S8dXLdEexiDf8nYDelfsu45uimNf3qa2Y5HtBUGOXiOLz53uPO2AlKO/5T5RWxMormtRqzRF5JtU/+Hun+kfC5Tiqzs57rlA14ydkOlKln3knUbwvWowuFDFYi/2H7bxYvnsGzbhYRYjb8pnL9YHXRKg4XKBhn3lGaTh0uDSnoER+AEEFBfxEJlo6PzEyjuakUUrmwixYYonRzXeChlmqkisEoh0spKNX8/OwKOgCNwwgi8UNlf9xmMSUIFMCVi2g+xIsSdI+AIOAIni0CwTpny987YOwk1IPezzliptt55soB6wR0BR+A0ERD/QaRM9Qf/crqXUGWl8p4Vxysd7hwBR8AROEUEfleh34sP069KRYj0EirxJIQ9GS/E0ku97B+p45eOgCPgCJSDgHiP9/E54MFBN0ioQQLCXgbTd0joJ8X71jp4d8udI+AIzIyA+tlOf1MWPqOcD2ew/FGGJc+TBl3Xe6iNhBJ2qYqDVPlEtEswr0o9ayS8ufHXqG6w8CtHYE4EWNtztwAC4jzWTlk35RPgUe7/veCbnJRxgZUAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left( \\left[\\begin{matrix}1 & -2 & 0 & -1 & 3 & 0\\\\0 & 0 & 1 & 2 & -2 & 0\\\\0 & 0 & 0 & 0 & 0 & 0\\end{matrix}\\right], \\  \\left( 0, \\  2\\right)\\right)$"
      ],
      "text/plain": [
       "⎛⎡1  -2  0  -1  3   0⎤        ⎞\n",
       "⎜⎢                   ⎥        ⎟\n",
       "⎜⎢0  0   1  2   -2  0⎥, (0, 2)⎟\n",
       "⎜⎢                   ⎥        ⎟\n",
       "⎝⎣0  0   0  0   0   0⎦        ⎠"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Aug.rref()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The solution can be written as:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$$\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "x_1 \\\\ x_2 \\\\ x_3 \\\\x_4 \\\\ x_5\n",
    "\\end{matrix}\n",
    "\\right]=\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "2x_2+x_4-3x_5 \\\\ x_2 \\\\ -2x_4+2x_5 \\\\x_4 \\\\ x_5\n",
    "\\end{matrix}\n",
    "\\right]=\n",
    "x_2\\left[\n",
    "\\begin{matrix}\n",
    "2 \\\\ 1 \\\\ 0 \\\\0 \\\\ 0\n",
    "\\end{matrix}\n",
    "\\right]\n",
    "+\n",
    "x_4\\left[\n",
    "\\begin{matrix}\n",
    "1 \\\\ 0 \\\\ -2 \\\\1 \\\\ 0\n",
    "\\end{matrix}\n",
    "\\right]\n",
    "+x_5\\left[\n",
    "\\begin{matrix}\n",
    "-3 \\\\ 0 \\\\ 2 \\\\0 \\\\ 1\n",
    "\\end{matrix}\n",
    "\\right]\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The $\\text{Nul}A$ is a subspace in $\\mathbb{R}^5$ with dimension of 3. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# <font face=\"gotham\" color=\"purple\"> Null Space vs Col Space </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAKgAAABLCAYAA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KxeltXhMw4Pu+zaRoFZh+Gsx/awV1OTNC25jwFjE0l5AwaoO+S2fJi6/pVLZdcXxoqD5rhgWSbOj/MdU0aMHC3029dwrIVFc9a6B7eP5Vnq9Zgy5JH1RAtt6gP4h0/gj0n1HOj/NnlScHFEQKgSK80jVsGUbPQ26LVBgYmDUPvriv8OZ4JZqVHdwQpcUCl2RACo2Ft4MblhSC5T2OgVR90HG5WSxjYCIDpqATCbPoeRkwBc3Lt+U2kQFT0ImEWfS8DITTTPxblWbuTL6vfdFus0z2XBAD0jk+uR53QUJBmaz1iwma8WadyG1mZs83koF6Ej9W+v8Ar7c4DGGoFjUAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}2 & 4 & -2 & 1\\\\-2 & -5 & 7 & 3\\\\3 & 7 & -8 & 6\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡2   4   -2  1⎤\n",
       "⎢             ⎥\n",
       "⎢-2  -5  7   3⎥\n",
       "⎢             ⎥\n",
       "⎣3   7   -8  6⎦"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = sy.Matrix([[2,4,-2,1],[-2,-5,7,3],[3,7,-8,6]]);A"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Column space is a subspace in $\\mathbb{R}^n$, what is $n$? It is the number of rows, $n=3$.\n",
    "\n",
    "Null space is a subspace in $\\mathbb{R}^m$, what is $m$? It is the number of columns, $m=4$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Find any nonzero vector in $\\text{Col}A$ and in $\\text{Nul}A$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Any column in the matrix can be a nonzero column in $\\text{Col}A$, for instance first column: $(2, -2, 3)^T$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "But to find a nonzero vector in null space requires some effort, construct the augmented matrix then turn it into rref."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAS8AAABLCAYAAAAhzAEgAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAQ00lEQVR4Ae2dbY7cNhKGZwz/XszawP73+AaT9Qni3CBOTpDkBjZ8gsC5gb0nSOwb2DmBk7mBfYAFEg/yewHv+3BUiqSmPlotqtQzVYBaEj+qii/JUpFNiaefP38+mUKnp6e/K90zpX+XS6/4C4WTJkdvlO9JLiLCAoFDEVDb+yAe5zk+anenufAI2xYCqkPq762OL1RnV1O0uzslkRi/VLqPfYarw+Mn3dOYmvSxeRPXgcDCCLzI8PtKYV9nwiNogwjItnyUnXkj1f6jY5Kjc6pMg0URQxoADB8MWUSlM8/rIYoMMo3IQKAwAmqP30vES7XF8LwKY70ke9XbJ/FjhPdqjO+g5yVGZ2KA4YLZJFduTKDFV8bute4nu4mW95Cz5NpT+g/xeajjxVaMrXTDwzW6p4vvlsbdmM85e2LnKXsOVpFnNgJ4XW9V3+9G+6USnPQdYoJx+b0vvhmudHheuHHnzfDmteIwhvCkkzI/RvqzZpqS15XMr00GsnWk+RIL8zg39Hhq8hUGnjyFevG0tGucpQf15YLdHNnKg+claPrbd8RtExvVGzbi7Vj93FGiLMny0XkYMj7LJpgRKGWudDzR8YOy/zyDxewsKg+NGUPJuDoR+uiC+6bHcx257i/e7T3pw3xhIl1f6uI3HYvhf815/19P7Dxl749U5FgIAdr8Y9X94Jxlr/FSZjrUpTpR9t/FhZRckw3uKAahS+8VAFB4YV5EJeXmCdEXo+tNnth5yvbG/VbKl82hL2B3bIoni0PWeFUWD8/L/amf1Xpe4GNl+zOTFe8LIn51ahjNnG7My50oDXXhSZ7Yecr2xPy2y8b2nKvtP+0DImu8lPi5jqlLI/p4bya8YSCGdLo3FFkqTk8ZM545+fcrubm4Uiq1+Hpi5ym7BULcrI5ANW2C94UtytKO8VKD4SnP4T0PlFV4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4YXpbLprOS6yl7DKst68Z7oTQkHjTmOa+5Ye+msRmr2IjfHwFsj3LxvnVuJ+7E8JQnR5eqjHhDPymebYpGSXnwvHjp+qHyFJl4H1UiEgQCFQJqj3heL9UWTwOU40NA9YeHz9dneu1Ja8LeiqgKx9vCaCXvy8LjHAgEAoHASgg8l5xXQ45Q1nihnDIxdMSIwSQoEAgEAoFVEKi8LoaNg6O+XuNVafmdznhfueUNqxQkhAQCgcDtQUC2BqPFcHF0i7RB4yXvi7UVHIdunikWQYFAIBAIjCLARy/fyfbkl0c0sg8aL9KJCd9TYuvyUgtXG+rEZSAQCNxWBGRjWFvKgc0ZpVHjVXGA2YvKpRtj+kHpPncO/mYPCgSKIKC2ttPmJChGC0XQLsqUOuOLvcy1j1LfOq9WRjG7VAPBgPEaTx9jlkfwmeAcxdKJHCoRthQCzJEEHTECsi/MdTHPNfkVwf8DYasKsEQiM3gAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left( \\left[\\begin{matrix}1 & 0 & 9 & 0 & 0\\\\0 & 1 & -5 & 0 & 0\\\\0 & 0 & 0 & 1 & 0\\end{matrix}\\right], \\  \\left( 0, \\  1, \\  3\\right)\\right)$"
      ],
      "text/plain": [
       "⎛⎡1  0  9   0  0⎤           ⎞\n",
       "⎜⎢              ⎥           ⎟\n",
       "⎜⎢0  1  -5  0  0⎥, (0, 1, 3)⎟\n",
       "⎜⎢              ⎥           ⎟\n",
       "⎝⎣0  0  0   1  0⎦           ⎠"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Aug = sy.Matrix([[2,4,-2,1,0],[-2,-5,7,3,0],[3,7,-8,6,0]]);Aug.rref()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The solution set with a free variable $x_3$ (because column 3 has no pivot) is \n",
    "\n",
    "$$\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "x_1 \\\\ x_2 \\\\ x_3\\\\x_4\n",
    "\\end{matrix}\n",
    "\\right]=\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "-9x_3 \\\\ 5x_3 \\\\ x_3\\\\0\n",
    "\\end{matrix}\n",
    "\\right]\n",
    "$$\n",
    "\n",
    "If we pick $x_3 =1$, a nonzero vector in $\\text{Nul}A$ is $(-9, 5, 1, 0)^T$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now consider two vectors\n",
    "\n",
    "$$\n",
    "u = \\left[\n",
    "\\begin{matrix}\n",
    "3 \\\\ -2 \\\\ -1\\\\ 0 \n",
    "\\end{matrix}\n",
    "\\right],\\qquad\n",
    "v = \\left[\n",
    "\\begin{matrix}\n",
    "3 \\\\ -1\\\\3\n",
    "\\end{matrix}\n",
    "\\right]\\\\\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Is $u$ in $\\text{Nul}A$? It can be verified easily"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACoAAABLCAYAAAAGaxWkAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADxklEQVRoBe2b8W3UMBTGc4i/0RUkBjg2KDAB1w1aNqAdAXUCVDZoR+gxQpkA2g1gACSqigXC9wW/yM35YjvvxbSSn+Q6dhz7d99zEvv1rmmaZh+p3ZE2bds2JRLG/7GDAcO3zVOcFPuMAzb27adfmPn4LND/AeoOpV4UXZVQLmcMAB4jbSkq4JPzxWIhqvxGJ6+QzjCKiVd8108G5IWAvEb2CWBfXHmJ/Br1BxawT9ip1gBDFy0Fkv3h+A4Zoc9Z1poJKCCOkG4CMN9Qt8YHoboqswJdg+I2QEJVaTyvMjVoolrPVZS4WA2KPgRC1POZROUH43ofLnT8IlSZU2ehqKgWGlfU5nNVZWpQ9xgiRMi9Uqd+6KtBnUxXyFfu2M9EUZ5XmRXoBhRvAiSvUXfjqR5oklZlAgqQCwx3i0dVv9Jxj633qP+QhjLeyuxdj2Go3ikAZQq8RfkdPkTojTVOFThrBurc+zEwhkmVietNSCKdVNCIQNmnq6LZkkUuqIpGBMo+XRXNlixywaNR1OwVGhGE+/4V2py4dlynsswARfIScB8XMEg2W0gHfRPsHFB9wA3lLlyD/NCv94+lDetKuZ5Qx/4yEOVLJNrpv2z8bylQLvXuXOqIoBLLyVZkjgKK83DPp/LUTQr5lFLUZ+SNtUYFI38n+BDcHUStiKJCAUDeuITk6p/T4TtSkhUFhXqE67YmzvUMSx6hvgtVjhEngaIzPl6+IjFPNQJ0UKELCId+eUNtkO+hPHpzEfSZ60jyrX5dJ9y8TTKA0OV8hg7B6XpOBaaQqi9R3xlB/7hjyV3RJnPeYDSaN1FUucGov6RM0FmN3gAg3XoVcK8ELaKv0dlBnQpb22jAM1jBOc9H1Oj8ZB9FQAFyATCGyP2HOxcl/EdEVM1ioBzIASVBsf3Q/subaQiRUq6gKSrltKmK5qiV0rYqmqJSTpuqaI5aKW0fjaJm73q8x1dQRhVgiCnLRa0qAIHruQrKDjDg/d8HJELH6LP/TomV69UBBkCNmhUotxhcU/brSijUH48SJJ40maNuCacKMMR4rRS9Nw4XyajICjDc6yBQMFFU+gUgb0xCZgcYpI9duSkopgDnarclBjT3RMkBhl2AUj+L69k5oLlP5w3FAMOSdRozAaXLnduHLAww0DgdVKZ2vVNraoAhGV4NyuclYOliVYAhRqwGdQOoAwxFQKGqOsBQBJSDAJbBhckBhhioyV0fG8TifAW1UNHvoyrqq2F1LFuR0I8GHtQPBvhNRNmUDT+8+luKww5HyvLV+GCTvyvo6GPzzL5/AAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}0\\\\-3\\\\3\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡0 ⎤\n",
       "⎢  ⎥\n",
       "⎢-3⎥\n",
       "⎢  ⎥\n",
       "⎣3 ⎦"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u = sy.Matrix([[3],[-2],[-1],[0]])\n",
    "A*u"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$Au\\neq \\mathbf{0}$, therefore $u$ is not in $\\text{Nul}A$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Is $v$ in $\\text{Col}A$?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUoAAABLCAYAAAAWAs4UAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAT80lEQVR4Ae2dW7IUNxKGOQTPExhHzLvxDo7NCrB3AHgF2DuwgxUQzA7AKwCzg4NXAD47gHmfCGPCzxPB/J9aWaOqVl26ui6q7syI6qqSVFLqVyqVuvbF58+fbwyhi4uLPxTuF4V/kwsv/0u5EyZHr/Xdw5yHuzkCW0JAcv5e/N7N8SwZv8i5u1tZCKgMKb8rXd+ozD4N4e7WkECK+LnCfWhTko04/qV3hCmlD+mLPzsCG0bgWYb37+X2IOPuTgUiID32QTrttVj7VdcgA+5CH3VmRREiAET4VZf2VTizKL+Gkc5I3dMRmBkB5FFyeJ0mI7fber8ztXwq3h8V73PF6xZlCnjhzyq3v8QiveQXfax2WpRRsFCSRDbIRO1L0PwVN4r1N12DzV/79pi70jWL4E/F87WuZ1NXnLH8iTcsd6M7eng8Ne4W+Zh7ydhl8vO7+EUxmrLkGfpmd/NfRyBYk1eSkzd9OqBTUQpIlCRd7l6NOwT0KLjE+VHXt7qyYz1D4hoTRukzhvpU+cHsvhH5+UP37/uAGpPe0G+MD4XHKmHoAt5oSP6tOw3J6ha6+CgSO7BqIWSMCxzBjzKn7Cdt8BWn00YRkCy8kVwjFxgoDJ+00s02n1hR6Xb/0hbmUHeEVNdDXT/p25eHfn9MeOWH7tFtpR2UJHHBj24GFE5rEY0HXcKgJGFCz1hC73RNhj/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dMuy9HJfPWx3tJ/siSrnD+ZIYv/t/6StcDXZfplQnrTueHAOeUQhiKe3Rrz2XngLL8WcJ0W5V4aisP6/GJ4rYW/p7e7yud613Ss/6umXZfxkrmjcNEsHpp1KxHwP58yuytys4a1748zuYvXrAGrBcEn01C3vC3MOZP4z25UWCR+718BCQ7yAvG2+s2fdemKNGqrKlEy066Fi0yMmmc4nEQrZl2H4Ml8wbv4o9tlsWS+ENpX0voq95Kg1n+JuEidVPY53JzJZmCcp7PNifTqpf2ut7gJOHBiuSjYFXi5uQIbBwBO9ovZENKkvfWirHxvDr7hyGAQdj5HztZRUkaUpZ0p1CY1nfH2ckR2CQCkudq6Vm0Oq+iQbDJ/DjT0yAgWaDnTNe7s9FsVZSRDSZYsCoZ33FyBDaPgGSZSsHfmM65FG3zOJ1DBqIs0LPo/VvbTkUpYWI9EdfzcwDO83gWCLDCgp6SkyPAYdRvpOeyS4JSeDoVJQEVCYP4nMRiA57p9/7sCGwNAeS56oZvjXnndxoEpM9sBcSgScpeRRnZIrJn0VTt4/S9wjW3lLG0xMkRKAEBljeFP7Ufw4xke0++FY/3uMaAue43lBmn9g/qXbQtD6plQZGx7AJlyVbDtohppduWWngLXkPUX6ZGQPLJODryh6VAD4iK8F6y21zjySEk73SNpdrs+dhI/Lv1EJBsHDxO/T9F1kmF2JH73AAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left( \\left[\\begin{matrix}1 & 0 & 9 & 0 & 5\\\\0 & 1 & -5 & 0 & - \\frac{30}{17}\\\\0 & 0 & 0 & 1 & \\frac{1}{17}\\end{matrix}\\right], \\  \\left( 0, \\  1, \\  3\\right)\\right)$"
      ],
      "text/plain": [
       "⎛⎡1  0  9   0   5  ⎤           ⎞\n",
       "⎜⎢                 ⎥           ⎟\n",
       "⎜⎢             -30 ⎥           ⎟\n",
       "⎜⎢0  1  -5  0  ────⎥, (0, 1, 3)⎟\n",
       "⎜⎢              17 ⎥           ⎟\n",
       "⎜⎢                 ⎥           ⎟\n",
       "⎝⎣0  0  0   1  1/17⎦           ⎠"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "v = sy.Matrix([[3],[-1],[3]])\n",
    "A.row_join(v).rref()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The augmented matrix show there are solutions, i.e. $v$ is a linear combination of its column space basis, so $v$ is in $\\text{Col}A$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# <font face=\"gotham\" color=\"purple\"> Row Space </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<font face=\"gotham\" color=\"red\"> Row space</font>, denoted as $\\text{Row}A$, is all linear combination of row vectors and subspace in $\\mathbb{R}^n$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If we perform row operations on $A$ to get $B$, both matrices have the same row space, because $B$'s rows are linear combinations of $A$'s. However, row operation will change the row dependence. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## <font face=\"gotham\" color=\"purple\"> An Example </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Find the row, column and null space of "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAOwAAABkCAYAAACFMNyhAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAOnElEQVR4Ae2dUXLcNhKGpVSeU7JSte+Wb6DYJ1jpBlZukM0NkvIJXPYNopxgY9/A9gm8zg3kfd+qWKq9gPJ/HGCM4WBGJAcggJnuKgxJEAQaP7qBBgj2HB8dHZ0rfFKI0dv7+/ur2A2LMwQMgfQIHB8f3yjXs1jO0sXjb4Mbr3VO4pA+hxd2bggYAtkReBUp4VJxz4kPFfY3abApaAQt9XrnwubP8JbiTnR9apiFqNj5JgQkL4yaFwp/SGbuNqXT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Fyz0a6458TTFNaJgetVmTc1v8gxRrJdvXEEz3/rlBpJ8Uf8JcL3KXFSoGbaJDee30RAOtQohAaKCc7izh7+utEEc7ekI/hr8RGbp16Ir6YWnHLjaSPsVyX0ZleJudpXLsqcrb3C0kjB9ABM5nAEzz5uXuH4vcyM9uyYg1pcAMyGZzKFFcCDHHQv2qDKX8wulLV6J9Zj0BvSLlKUoo7gVT4rwvxznv/zLUxhLJ3HbsQaU+XiaXPiaY7EizevMWAIbEdAHZk5Et8Okd01BOpEwBad6mwX48oQiCJgChuFxSINgToRMIWts12MK0MgioApbBQWizQE6kQgfK3DlxF9LnmZ3uJ7sH497NoQaAIB6eCNGD3bxCwKy97Z5QvrXsJq9tX2+LJLQ2BfEdj6aeffu73pQpLoTKsAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}-2 & -5 & 8 & 0 & -17\\\\1 & 3 & -5 & 1 & 5\\\\3 & 11 & -19 & 7 & 1\\\\1 & 7 & -13 & 5 & -3\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡-2  -5   8   0  -17⎤\n",
       "⎢                   ⎥\n",
       "⎢1   3   -5   1   5 ⎥\n",
       "⎢                   ⎥\n",
       "⎢3   11  -19  7   1 ⎥\n",
       "⎢                   ⎥\n",
       "⎣1   7   -13  5  -3 ⎦"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = sy.Matrix([[-2, -5, 8, 0, -17],\n",
    "               [1, 3, -5, 1, 5], \n",
    "               [3, 11, -19, 7, 1], \n",
    "               [1, 7, -13, 5, -3]]);A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAT8AAABkCAYAAADwmDcrAAAACXBIWXMAAA7EAAAOxAGVKw4bAAATyUlEQVR4Ae2dS47dNhaGqwyjhw3HBnqeyg4qyQoSzzNwn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UfiGX3+of6y81PWUXRDhIZ8AZuDkMSFeh9GjuPgot2M7M9yo/3czcGI5V99rrROcBzoAz4Awcx8DPiv5Kuis9vSVKq1f5EU+JsF/ahTTqWhOfIzh+6gw4A87ANAako5ibzIHOGnSDyi+kQGJPgkk5lOgbxXvfOJhv484ZKJIB1dVWnRVQb+0UWVq9oCizr4eau5ZC1zw/C6/+ldhrVRAUIMvQGARJOaa3PEoFyM+nvnQQ495FMEAfkbsdMyD9RF8f/Xwsdxzl/g/99eAQSmZLQwAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left( \\left[\\begin{matrix}1 & 0 & 1 & 0 & 1\\\\0 & 1 & -2 & 0 & 3\\\\0 & 0 & 0 & 1 & -5\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right], \\  \\left( 0, \\  1, \\  3\\right)\\right)$"
      ],
      "text/plain": [
       "⎛⎡1  0  1   0  1 ⎤           ⎞\n",
       "⎜⎢               ⎥           ⎟\n",
       "⎜⎢0  1  -2  0  3 ⎥           ⎟\n",
       "⎜⎢               ⎥, (0, 1, 3)⎟\n",
       "⎜⎢0  0  0   1  -5⎥           ⎟\n",
       "⎜⎢               ⎥           ⎟\n",
       "⎝⎣0  0  0   0  0 ⎦           ⎠"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "B = A.rref();B"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The basis of row space of $B$ is its first 3 rows: $(1,0,1,0,1), (0, 1, -2, 0, 3), (0, 0, 0, 1, -5)$ which are also the basis of row space of $A$. However it does not necessarily mean that first 3 rows of $A$ forms the basis for row space, because the dependence among rows changed by row operation."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In constrast, the basis of col space of $A$ is $(-2, 1, 3, 1)^T, (-5, 3, 11, 7)^T, (0, 1, 7, 5)^T$."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "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 & 0 & 0 & 0\\end{matrix}\\right], \\  \\left( 0, \\  1, \\  3\\right)\\right)$"
      ],
      "text/plain": [
       "⎛⎡1  0  1   0  1   0⎤           ⎞\n",
       "⎜⎢                  ⎥           ⎟\n",
       "⎜⎢0  1  -2  0  3   0⎥           ⎟\n",
       "⎜⎢                  ⎥, (0, 1, 3)⎟\n",
       "⎜⎢0  0  0   1  -5  0⎥           ⎟\n",
       "⎜⎢                  ⎥           ⎟\n",
       "⎝⎣0  0  0   0  0   0⎦           ⎠"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Aug = A.row_join(sy.zeros(4,1));Aug.rref()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The null space is \n",
    "\n",
    "$$\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "x_1 \\\\ x_2 \\\\ x_3\\\\x_4 \\\\x_5\n",
    "\\end{matrix}\n",
    "\\right]=\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "-x_3-x_5 \\\\ 2x_3-3x_5 \\\\ x_3\\\\5x_5 \\\\x_5\n",
    "\\end{matrix}\n",
    "\\right]=\n",
    "x_3\\left[\n",
    "\\begin{matrix}\n",
    "-1 \\\\ 2 \\\\ 1\\\\0 \\\\0\n",
    "\\end{matrix}\n",
    "\\right]+\n",
    "x_5\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "-1 \\\\ -3 \\\\ 0\\\\5 \\\\1\n",
    "\\end{matrix}\n",
    "\\right]\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# <font face=\"gotham\" color=\"purple\"> Rank </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Definition of rank:\n",
    "The <font face=\"gotham\" color=\"red\"> rank </font> is the dimension of the column space of $A$. The <font face=\"gotham\" color=\"red\"> nullity </font> of $A$ is the dimension of the null space."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## <font face=\"gotham\" color=\"purple\"> The Rank Theorem</font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The dimensions of the column space and the row space of an $m \\times n$ matrix $A$ are equal that is why we only need to say rank is the dimension of the column space. \n",
    "\n",
    "This common dimension, the rank of $A$, also equals the number of pivot positions in $A$ and satisfies the equation\n",
    "$$\n",
    "\\operatorname{rank} A+\\operatorname{dim} \\mathrm{Nul} A=n\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The intuition is that when a matrix $A$ is converted into rref $B$, we can indirectly(matching the same column from $B$ to $A$) see the basis of column space, those columns in corresponding rref have pivots. \n",
    "\n",
    "And in rref, we can also see the basis of row space directly, every row in the basis of row space have a pivot as well. And those rows which does not have pivots are for free variables, which is the dimension of null space. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## <font face=\"gotham\" color=\"purple\"> Example 1 </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If $A$ is $45 \\times 50$ matrix with a $10$-dimension nullity, what is the rank of $A$?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$10D$ nullity means 10 free variables, so the pivots are $50-10=40$, which is also the rank of $A$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## <font face=\"gotham\" color=\"purple\"> Example 2 </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The matrices below are row equivalent.\n",
    "$$\n",
    "A=\\left[\\begin{array}{rrrrr}\n",
    "2 & -1 & 1 & -6 & 8 \\\\\n",
    "1 & -2 & -4 & 3 & -2 \\\\\n",
    "-7 & 8 & 10 & 3 & -10 \\\\\n",
    "4 & -5 & -7 & 0 & 4\n",
    "\\end{array}\\right], \\quad B=\\left[\\begin{array}{rrrrr}\n",
    "1 & -2 & -4 & 3 & -2 \\\\\n",
    "0 & 3 & 9 & -12 & 12 \\\\\n",
    "0 & 0 & 0 & 0 & 0 \\\\\n",
    "0 & 0 & 0 & 0 & 0\n",
    "\\end{array}\\right]\n",
    "$$\n",
    "1. Find rank $A$ and $\\operatorname{dim}$ Nul $A$\n",
    "2. Find bases for Col $A$ and Row $A$.\n",
    "3. What is the next step to perform to find a basis for Nul $A$ ?\n",
    "4. How many pivot columns are in a row echelon form of $A^{T} ?$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1. $rank(A)=2$, because $B$ has two pivots. And nullity is the number of free variables, there are 3, so $\\text{dim Nul}A = 3$. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2. Bases for $\\text{Col}A$ is $(2,1,-7,4)^T, (-1,-2,8,-5)^T$, and for $\\text{Row}A$ is $(1,-2,-4,3,-2),(0,3,9,-12,12)$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3. Perform rref on augmented $A$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAATQAAABkCAYAAAAIeMzcAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAU+0lEQVR4Ae2dS47dxhWGuwUhw0CWgMzT3kHLWoGsuQd+rMDWDmxoBYa8A8krsKVB5pJXoLh3IC8gQCwhyDCA8n/sOlRdsvi4lywW2TwF8JKs1zn1V/G/p17k+YcPH87GuPPz898V7wfFf52Kr/BL+RMn5V4q3VepAPdzBLaMgNr9W+l/kSqD2vx5yt/9xiEgbMH1lY77wvL9mFS3x0RSxs8U748uMmvk8ZPuqeTY/RHf+LUjcIMQeJooyyP5fZnwd68jEBDf/CHueakkP+sYZRCdK1GvCGVIxZDh3/tYUvHMQvsURXoz9cBNIUDdqk6vYqXld0f3d72uY1Sur4XNd7p6JmzcQmvDc7SP8HynRPQOnw8l7rXQQqOFzMhslMk3JNDClTcE+ELHaHPS0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FVEVhlEFllpZm/nx0BR8ARKIjAE8l+3mcwJQkNhZWIbifERibuHAFHwBEohkCwzuhy9vYYOwktaP6tzlhpqaUWxQrngh0BR2A/CIh/IDK6mo9D77Gz8L2EpsSs8+DI+q6yTu08wBFwBByBs7OfBcJr8VF6qUaEUC+hEU+Z8E6oC7FkrsW2kTp+6Qg4Ao7ARwTEO6yH5YCHBt0goYUcyOxpMP2GMn2reB8aB2tH3DkCNw4BtfNWe1chvUczX02D5VdDXU0T17UOzcKrszK7UsVBamxRYqIg5Viq8TgVID9fxtEBjHtvHgHGdtxlQECcw9gZ42ZsQRvl/g970eQIwQoX8QAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left( \\left[\\begin{matrix}1 & 0 & 2 & -5 & 6 & 0\\\\0 & 1 & 3 & -4 & 4 & 0\\\\0 & 0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0 & 0\\end{matrix}\\right], \\  \\left( 0, \\  1\\right)\\right)$"
      ],
      "text/plain": [
       "⎛⎡1  0  2  -5  6  0⎤        ⎞\n",
       "⎜⎢                 ⎥        ⎟\n",
       "⎜⎢0  1  3  -4  4  0⎥        ⎟\n",
       "⎜⎢                 ⎥, (0, 1)⎟\n",
       "⎜⎢0  0  0  0   0  0⎥        ⎟\n",
       "⎜⎢                 ⎥        ⎟\n",
       "⎝⎣0  0  0  0   0  0⎦        ⎠"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = sy.Matrix([[2,-1,1,-6,8,0],\n",
    "               [1,-2,-4,3,-2,0],\n",
    "               [-7,8,10,3,-10,0],\n",
    "               [4,-5,-7,0,4,0]])\n",
    "A.rref()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The $\\text{Nul}A$ and basis is\n",
    "\n",
    "$$\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "x_1 \\\\ x_2 \\\\ x_3\\\\x_4 \\\\x_5\n",
    "\\end{matrix}\n",
    "\\right]=\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "-2x_3+5x_4-6x_5 \\\\ -3x_3+4x_4-4x_5 \\\\ x_3\\\\x_4 \\\\x_5\n",
    "\\end{matrix}\n",
    "\\right]=\n",
    "x_3\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "-2 \\\\ -3 \\\\ 1\\\\0 \\\\0\n",
    "\\end{matrix}\n",
    "\\right]+\n",
    "x_4\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "5 \\\\ 4 \\\\ 0\\\\1 \\\\0\n",
    "\\end{matrix}\n",
    "\\right]+\n",
    "x_5\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "-6 \\\\ -4 \\\\ 0\\\\0 \\\\1\n",
    "\\end{matrix}\n",
    "\\right]\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4. Transpose $A$ then do rref."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPUAAACWCAYAAAAG0c6RAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAWbUlEQVR4Ae2dTc7cNraGbcO4w8BJgMad9pcdfE5WEHveAye9grR3YCMrCJIdOL2CdDzI3L4ryI134IwvLtC2EfSwAff7yDyCflhifVXiT0mHgEoSSfG85xWPDklRrNvv37+/dUy4ffv2b8r3VPlfxvIr/Vrx5ImF57ruq1iCx22DAd3/19LkKqaN7v3tWLzHpRkQr3D6Qtt98fgufcWtW3ePyaSCnynf74cMelLGDzrnBg/D78MTP94kA99HtHqouEeReI86kgHZ3O+yv+fK/ndtRznG27posXgVyE2hwD8vPSmUzzz1ZwBZLNQTd8GA6sTfpOgz1Qf31GfecXH5VkXQUv4xVdSdpQwq6J7SMWgKO8r1L5U3TOMhoO11kDFMynosed+H7Yn2z7RFm4xZQZxQODgDXjD/pu2FNh6kRQMytRW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kDX8x/zE5uXsbS4mc171sckcfSLcJGadmODBpqpkbNUrAEc+sfzlb4tdkuKirWxLa4/gX6CiL7ImrK7kEcOGgZG5Bbx3eA1j1EW4t61PRG8ZFR6wZaE5z3yTkC5V9FCjaPNOrwR/KdE1VTdgp3y9jA3jq+FL9bTMfxMuqd9NQo/502muD2JCBurVBzUfiaslP8tYwN7K3jS/G7qfTQ9Kb5zTr68yBLp4k12pTrvbafp/FL58qPEK67SuTjQ+5HlkfHNL3faru2uFx7yagmO6VTy9jAfgo+XUOLT5eP65efn8eHOOUhy025F+PyrhJi4QdFPtETgYvexTKcEXdf1/pi/nMCa/IyRzOPaR3fHPEGY7BJqcV3Gs8P2eZtLH0awoV4zx+UftQC86FJwMcan+maLANeU5x+3jYDqhN46meqD7fbRno56MTpE6HlK8eDdjYaKDPVdBPwzhhz560t3vfOgDNQnYFvheDHJccZNWpg6yKa4Bg3hXhwBpyBygwEL03ze7H1fNCoA/5vtMdbx15DVVbRxTsD+2FANogx0+x+HFrSB5VfNGpdzDswtmcHS/AEZ8AZKMHA3yXkpWwy/hprgGDRqMmnQviW9kpPilwTUgZw/NAZcAamDMj2mDPChi0mQ9KoQwkU9n1oAqQKfa187ycb79U8bJgB3e/ZfZe63sJb557D41epZreJOvSe2tK7vQp7pZuGYTOdk8GzWOA11uNYguL8FdcBYjYUTX/Pw8oMyO7oS9OPPnoK9X8A36v/22h8574AAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left( \\left[\\begin{matrix}1 & 0 & -2 & 1\\\\0 & 1 & -3 & 2\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right], \\  \\left( 0, \\  1\\right)\\right)$"
      ],
      "text/plain": [
       "⎛⎡1  0  -2  1⎤        ⎞\n",
       "⎜⎢           ⎥        ⎟\n",
       "⎜⎢0  1  -3  2⎥        ⎟\n",
       "⎜⎢           ⎥        ⎟\n",
       "⎜⎢0  0  0   0⎥        ⎟\n",
       "⎜⎢           ⎥, (0, 1)⎟\n",
       "⎜⎢0  0  0   0⎥        ⎟\n",
       "⎜⎢           ⎥        ⎟\n",
       "⎜⎢0  0  0   0⎥        ⎟\n",
       "⎜⎢           ⎥        ⎟\n",
       "⎝⎣0  0  0   0⎦        ⎠"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A.T.rref()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "There are 2 pivot columns."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Actually, we don't need any calculation to know the rank of $A^T$, because\n",
    "\n",
    "$$\n",
    "rank(A)=rank(A^T)\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# <font face=\"gotham\" color=\"purple\"> Orthogonality of $\\text{Nul}A$ and $\\text{Row}A$ </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##  <font face=\"gotham\" color=\"purple\"> $\\text{Nul}A \\perp \\text{Row}A$  </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here is the intersting connections of these subspaces we have discussed. Consider"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAG0AAABLCAYAAAB6DQl9AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAIYklEQVR4Ae2d4XEVNxSF/Rh+Zxwyk/95dGBwBdgdQKgA6ICMK8iYDoAKiOkApwKCO4ACMhPwpAHnfGtpR9bTPkva1a5ekGaEVtKu7tl7pCutdJ9Z7e3tHSh+UgyF91dXV09CFa2snAZWq9Vntb4OSRAfq7tOxStdc7MbvriZdj2bBk4Dko5V9phyl7TXYjGJJPWIAz1z4QpQ2b7y91Lbctv43q+luze+DqRXijZI8++Lyf9pSL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GLMBYgnAaPcg/z250qb8xirZ0p6TWzFyJWijE5EMYJNSbzL1tXSyqMa2HJdg6t5T0sjtGkyTxCVLcSk3JYlOCGUNvqkdEf8nCyetipdDLzyFtLMSzzmegX/4ul4CGoA412Dr1uqZ5/s0mTMvhAZTXmB2seMZmLBuHDLOY6hy6KfZvwLPMoZeyrUZyB6MmsIGtd6kNarnMor1dlyCINkkQWRLHs9wmzLmH9p8BSby5sYNjAIexJzqFL4R+Sm0WaaWxjYpcyWIgwCpn4fTKHMCxRDkbiToZs0kTKG5GEg6X77YM54gfxG727Bu0YrNYSRDuHTo1dOGIdf4Ois0mjtSHzE5RUQaHw9pvbS8IRjiif/SGM2avHoQZbeXkNNNLK63hyCY20yVVavsFGWnkdTy6hkTa5Sss36K4e8VXwJbb/nNzXyAx58cB/irseEgVp/CZtaCncfq82pLmy5f2vVENi/gOtAdJydFPQVwAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}5 & 8 & 2\\\\10 & 16 & 4\\\\3 & 4 & 1\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡5   8   2⎤\n",
       "⎢         ⎥\n",
       "⎢10  16  4⎥\n",
       "⎢         ⎥\n",
       "⎣3   4   1⎦"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = sy.Matrix([[5, 8, 2], [10, 16, 4], [3, 4, 1]]);A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAMkAAABLCAYAAADavqPWAAAACXBIWXMAAA7EAAAOxAGVKw4bAAANGElEQVR4Ae2dbY4UtxqFZ0b8jhBI93+GHUzCCkJ2EMgKAjsIYgUR7ICwgiTsAHbADTuABVwpMLq/r8Q9j8enqOp210fXl7vblmpc7c/jU379vna5POdfvnw56+POz8//VrqnSv82lV7xVwonTcq9Vr6HqYgSlm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AAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left( \\left[\\begin{matrix}1 & 0 & 0\\\\0 & 1 & \\frac{1}{4}\\\\0 & 0 & 0\\end{matrix}\\right], \\  \\left( 0, \\  1\\right)\\right)$"
      ],
      "text/plain": [
       "⎛⎡1  0   0 ⎤        ⎞\n",
       "⎜⎢         ⎥        ⎟\n",
       "⎜⎢0  1  1/4⎥, (0, 1)⎟\n",
       "⎜⎢         ⎥        ⎟\n",
       "⎝⎣0  0   0 ⎦        ⎠"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A.rref()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The basis of row space of $A$ is $(1, 0, 0)$ and $(0, 1, .25)$.And the $\\text{Row}A$ is \n",
    "\n",
    "$$\n",
    "\\text{Row}A=\n",
    "s\\left[\n",
    "\\begin{matrix}\n",
    "1 \\\\ 0\\\\ 0\n",
    "\\end{matrix}\n",
    "\\right]+\n",
    "t\\left[\n",
    "\\begin{matrix}\n",
    "0 \\\\ 1\\\\ 0.25\n",
    "\\end{matrix}\n",
    "\\right]\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The $\\text{Nul}A$ is \n",
    "$$\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "x_1 \\\\ x_2\\\\ x_3\n",
    "\\end{matrix}\n",
    "\\right]=\n",
    "x_3\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "0 \\\\ -.25\\\\ 1\n",
    "\\end{matrix}\n",
    "\\right]\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we can visualize their relations geometrically.Again keep in mind that Matplotlib does not render 3D properly, so you need some imagination as well.\n",
    "\n",
    "Here is what we observe. \n",
    "\n",
    "The $\\text{Row}A$ is a plane and $\\text{Nul}A$ is a line which is perpendicular to the plane. It is easy to grasp the idea if you notice that in a homogeneous system $Ab = \\mathbf{0}$, it breaks down into many dot products\n",
    "\n",
    "$$\n",
    "Ab =\\left[\n",
    "\\begin{matrix}\n",
    "A_{1i}\\cdot b \\\\ A_{2i}\\cdot b\\\\ A_{3i}\\cdot b\n",
    "\\end{matrix}\n",
    "\\right]\n",
    "$$\n",
    "\n",
    "where $A_{1i}$ and etc are the rows of $A$. In later chapters we will prove when the dot product of two vectors equals zero, then they are perpendicular."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "/* Put everything inside the global mpl namespace */\n",
       "window.mpl = {};\n",
       "\n",
       "\n",
       "mpl.get_websocket_type = function() {\n",
       "    if (typeof(WebSocket) !== 'undefined') {\n",
       "        return WebSocket;\n",
       "    } else if (typeof(MozWebSocket) !== 'undefined') {\n",
       "        return MozWebSocket;\n",
       "    } else {\n",
       "        alert('Your browser does not have WebSocket support. ' +\n",
       "              'Please try Chrome, Safari or Firefox ≥ 6. ' +\n",
       "              'Firefox 4 and 5 are also supported but you ' +\n",
       "              'have to enable WebSockets in about:config.');\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n",
       "    this.id = figure_id;\n",
       "\n",
       "    this.ws = websocket;\n",
       "\n",
       "    this.supports_binary = (this.ws.binaryType != undefined);\n",
       "\n",
       "    if (!this.supports_binary) {\n",
       "        var warnings = document.getElementById(\"mpl-warnings\");\n",
       "        if (warnings) {\n",
       "            warnings.style.display = 'block';\n",
       "            warnings.textContent = (\n",
       "                \"This browser does not support binary websocket messages. \" +\n",
       "                    \"Performance may be slow.\");\n",
       "        }\n",
       "    }\n",
       "\n",
       "    this.imageObj = new Image();\n",
       "\n",
       "    this.context = undefined;\n",
       "    this.message = undefined;\n",
       "    this.canvas = undefined;\n",
       "    this.rubberband_canvas = undefined;\n",
       "    this.rubberband_context = undefined;\n",
       "    this.format_dropdown = undefined;\n",
       "\n",
       "    this.image_mode = 'full';\n",
       "\n",
       "    this.root = $('<div/>');\n",
       "    this._root_extra_style(this.root)\n",
       "    this.root.attr('style', 'display: inline-block');\n",
       "\n",
       "    $(parent_element).append(this.root);\n",
       "\n",
       "    this._init_header(this);\n",
       "    this._init_canvas(this);\n",
       "    this._init_toolbar(this);\n",
       "\n",
       "    var fig = this;\n",
       "\n",
       "    this.waiting = false;\n",
       "\n",
       "    this.ws.onopen =  function () {\n",
       "            fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
       "            fig.send_message(\"send_image_mode\", {});\n",
       "            if (mpl.ratio != 1) {\n",
       "                fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
       "            }\n",
       "            fig.send_message(\"refresh\", {});\n",
       "        }\n",
       "\n",
       "    this.imageObj.onload = function() {\n",
       "            if (fig.image_mode == 'full') {\n",
       "                // Full images could contain transparency (where diff images\n",
       "                // almost always do), so we need to clear the canvas so that\n",
       "                // there is no ghosting.\n",
       "                fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n",
       "            }\n",
       "            fig.context.drawImage(fig.imageObj, 0, 0);\n",
       "        };\n",
       "\n",
       "    this.imageObj.onunload = function() {\n",
       "        fig.ws.close();\n",
       "    }\n",
       "\n",
       "    this.ws.onmessage = this._make_on_message_function(this);\n",
       "\n",
       "    this.ondownload = ondownload;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_header = function() {\n",
       "    var titlebar = $(\n",
       "        '<div class=\"ui-dialog-titlebar ui-widget-header ui-corner-all ' +\n",
       "        'ui-helper-clearfix\"/>');\n",
       "    var titletext = $(\n",
       "        '<div class=\"ui-dialog-title\" style=\"width: 100%; ' +\n",
       "        'text-align: center; padding: 3px;\"/>');\n",
       "    titlebar.append(titletext)\n",
       "    this.root.append(titlebar);\n",
       "    this.header = titletext[0];\n",
       "}\n",
       "\n",
       "\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_canvas = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var canvas_div = $('<div/>');\n",
       "\n",
       "    canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n",
       "\n",
       "    function canvas_keyboard_event(event) {\n",
       "        return fig.key_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    canvas_div.keydown('key_press', canvas_keyboard_event);\n",
       "    canvas_div.keyup('key_release', canvas_keyboard_event);\n",
       "    this.canvas_div = canvas_div\n",
       "    this._canvas_extra_style(canvas_div)\n",
       "    this.root.append(canvas_div);\n",
       "\n",
       "    var canvas = $('<canvas/>');\n",
       "    canvas.addClass('mpl-canvas');\n",
       "    canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n",
       "\n",
       "    this.canvas = canvas[0];\n",
       "    this.context = canvas[0].getContext(\"2d\");\n",
       "\n",
       "    var backingStore = this.context.backingStorePixelRatio ||\n",
       "\tthis.context.webkitBackingStorePixelRatio ||\n",
       "\tthis.context.mozBackingStorePixelRatio ||\n",
       "\tthis.context.msBackingStorePixelRatio ||\n",
       "\tthis.context.oBackingStorePixelRatio ||\n",
       "\tthis.context.backingStorePixelRatio || 1;\n",
       "\n",
       "    mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
       "\n",
       "    var rubberband = $('<canvas/>');\n",
       "    rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
       "\n",
       "    var pass_mouse_events = true;\n",
       "\n",
       "    canvas_div.resizable({\n",
       "        start: function(event, ui) {\n",
       "            pass_mouse_events = false;\n",
       "        },\n",
       "        resize: function(event, ui) {\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "        stop: function(event, ui) {\n",
       "            pass_mouse_events = true;\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "    });\n",
       "\n",
       "    function mouse_event_fn(event) {\n",
       "        if (pass_mouse_events)\n",
       "            return fig.mouse_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    rubberband.mousedown('button_press', mouse_event_fn);\n",
       "    rubberband.mouseup('button_release', mouse_event_fn);\n",
       "    // Throttle sequential mouse events to 1 every 20ms.\n",
       "    rubberband.mousemove('motion_notify', mouse_event_fn);\n",
       "\n",
       "    rubberband.mouseenter('figure_enter', mouse_event_fn);\n",
       "    rubberband.mouseleave('figure_leave', mouse_event_fn);\n",
       "\n",
       "    canvas_div.on(\"wheel\", function (event) {\n",
       "        event = event.originalEvent;\n",
       "        event['data'] = 'scroll'\n",
       "        if (event.deltaY < 0) {\n",
       "            event.step = 1;\n",
       "        } else {\n",
       "            event.step = -1;\n",
       "        }\n",
       "        mouse_event_fn(event);\n",
       "    });\n",
       "\n",
       "    canvas_div.append(canvas);\n",
       "    canvas_div.append(rubberband);\n",
       "\n",
       "    this.rubberband = rubberband;\n",
       "    this.rubberband_canvas = rubberband[0];\n",
       "    this.rubberband_context = rubberband[0].getContext(\"2d\");\n",
       "    this.rubberband_context.strokeStyle = \"#000000\";\n",
       "\n",
       "    this._resize_canvas = function(width, height) {\n",
       "        // Keep the size of the canvas, canvas container, and rubber band\n",
       "        // canvas in synch.\n",
       "        canvas_div.css('width', width)\n",
       "        canvas_div.css('height', height)\n",
       "\n",
       "        canvas.attr('width', width * mpl.ratio);\n",
       "        canvas.attr('height', height * mpl.ratio);\n",
       "        canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
       "\n",
       "        rubberband.attr('width', width);\n",
       "        rubberband.attr('height', height);\n",
       "    }\n",
       "\n",
       "    // Set the figure to an initial 600x600px, this will subsequently be updated\n",
       "    // upon first draw.\n",
       "    this._resize_canvas(600, 600);\n",
       "\n",
       "    // Disable right mouse context menu.\n",
       "    $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n",
       "        return false;\n",
       "    });\n",
       "\n",
       "    function set_focus () {\n",
       "        canvas.focus();\n",
       "        canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    window.setTimeout(set_focus, 100);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>');\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items) {\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) {\n",
       "            // put a spacer in here.\n",
       "            continue;\n",
       "        }\n",
       "        var button = $('<button/>');\n",
       "        button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n",
       "                        'ui-button-icon-only');\n",
       "        button.attr('role', 'button');\n",
       "        button.attr('aria-disabled', 'false');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "\n",
       "        var icon_img = $('<span/>');\n",
       "        icon_img.addClass('ui-button-icon-primary ui-icon');\n",
       "        icon_img.addClass(image);\n",
       "        icon_img.addClass('ui-corner-all');\n",
       "\n",
       "        var tooltip_span = $('<span/>');\n",
       "        tooltip_span.addClass('ui-button-text');\n",
       "        tooltip_span.html(tooltip);\n",
       "\n",
       "        button.append(icon_img);\n",
       "        button.append(tooltip_span);\n",
       "\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    var fmt_picker_span = $('<span/>');\n",
       "\n",
       "    var fmt_picker = $('<select/>');\n",
       "    fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n",
       "    fmt_picker_span.append(fmt_picker);\n",
       "    nav_element.append(fmt_picker_span);\n",
       "    this.format_dropdown = fmt_picker[0];\n",
       "\n",
       "    for (var ind in mpl.extensions) {\n",
       "        var fmt = mpl.extensions[ind];\n",
       "        var option = $(\n",
       "            '<option/>', {selected: fmt === mpl.default_extension}).html(fmt);\n",
       "        fmt_picker.append(option);\n",
       "    }\n",
       "\n",
       "    // Add hover states to the ui-buttons\n",
       "    $( \".ui-button\" ).hover(\n",
       "        function() { $(this).addClass(\"ui-state-hover\");},\n",
       "        function() { $(this).removeClass(\"ui-state-hover\");}\n",
       "    );\n",
       "\n",
       "    var status_bar = $('<span class=\"mpl-message\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n",
       "    // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n",
       "    // which will in turn request a refresh of the image.\n",
       "    this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_message = function(type, properties) {\n",
       "    properties['type'] = type;\n",
       "    properties['figure_id'] = this.id;\n",
       "    this.ws.send(JSON.stringify(properties));\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_draw_message = function() {\n",
       "    if (!this.waiting) {\n",
       "        this.waiting = true;\n",
       "        this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n",
       "    }\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    var format_dropdown = fig.format_dropdown;\n",
       "    var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n",
       "    fig.ondownload(fig, format);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_resize = function(fig, msg) {\n",
       "    var size = msg['size'];\n",
       "    if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n",
       "        fig._resize_canvas(size[0], size[1]);\n",
       "        fig.send_message(\"refresh\", {});\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
       "    var x0 = msg['x0'] / mpl.ratio;\n",
       "    var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
       "    var x1 = msg['x1'] / mpl.ratio;\n",
       "    var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
       "    x0 = Math.floor(x0) + 0.5;\n",
       "    y0 = Math.floor(y0) + 0.5;\n",
       "    x1 = Math.floor(x1) + 0.5;\n",
       "    y1 = Math.floor(y1) + 0.5;\n",
       "    var min_x = Math.min(x0, x1);\n",
       "    var min_y = Math.min(y0, y1);\n",
       "    var width = Math.abs(x1 - x0);\n",
       "    var height = Math.abs(y1 - y0);\n",
       "\n",
       "    fig.rubberband_context.clearRect(\n",
       "        0, 0, fig.canvas.width / mpl.ratio, fig.canvas.height / mpl.ratio);\n",
       "\n",
       "    fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_figure_label = function(fig, msg) {\n",
       "    // Updates the figure title.\n",
       "    fig.header.textContent = msg['label'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_cursor = function(fig, msg) {\n",
       "    var cursor = msg['cursor'];\n",
       "    switch(cursor)\n",
       "    {\n",
       "    case 0:\n",
       "        cursor = 'pointer';\n",
       "        break;\n",
       "    case 1:\n",
       "        cursor = 'default';\n",
       "        break;\n",
       "    case 2:\n",
       "        cursor = 'crosshair';\n",
       "        break;\n",
       "    case 3:\n",
       "        cursor = 'move';\n",
       "        break;\n",
       "    }\n",
       "    fig.rubberband_canvas.style.cursor = cursor;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_message = function(fig, msg) {\n",
       "    fig.message.textContent = msg['message'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_draw = function(fig, msg) {\n",
       "    // Request the server to send over a new figure.\n",
       "    fig.send_draw_message();\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_image_mode = function(fig, msg) {\n",
       "    fig.image_mode = msg['mode'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Called whenever the canvas gets updated.\n",
       "    this.send_message(\"ack\", {});\n",
       "}\n",
       "\n",
       "// A function to construct a web socket function for onmessage handling.\n",
       "// Called in the figure constructor.\n",
       "mpl.figure.prototype._make_on_message_function = function(fig) {\n",
       "    return function socket_on_message(evt) {\n",
       "        if (evt.data instanceof Blob) {\n",
       "            /* FIXME: We get \"Resource interpreted as Image but\n",
       "             * transferred with MIME type text/plain:\" errors on\n",
       "             * Chrome.  But how to set the MIME type?  It doesn't seem\n",
       "             * to be part of the websocket stream */\n",
       "            evt.data.type = \"image/png\";\n",
       "\n",
       "            /* Free the memory for the previous frames */\n",
       "            if (fig.imageObj.src) {\n",
       "                (window.URL || window.webkitURL).revokeObjectURL(\n",
       "                    fig.imageObj.src);\n",
       "            }\n",
       "\n",
       "            fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n",
       "                evt.data);\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "        else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n",
       "            fig.imageObj.src = evt.data;\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        var msg = JSON.parse(evt.data);\n",
       "        var msg_type = msg['type'];\n",
       "\n",
       "        // Call the  \"handle_{type}\" callback, which takes\n",
       "        // the figure and JSON message as its only arguments.\n",
       "        try {\n",
       "            var callback = fig[\"handle_\" + msg_type];\n",
       "        } catch (e) {\n",
       "            console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        if (callback) {\n",
       "            try {\n",
       "                // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n",
       "                callback(fig, msg);\n",
       "            } catch (e) {\n",
       "                console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n",
       "            }\n",
       "        }\n",
       "    };\n",
       "}\n",
       "\n",
       "// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n",
       "mpl.findpos = function(e) {\n",
       "    //this section is from http://www.quirksmode.org/js/events_properties.html\n",
       "    var targ;\n",
       "    if (!e)\n",
       "        e = window.event;\n",
       "    if (e.target)\n",
       "        targ = e.target;\n",
       "    else if (e.srcElement)\n",
       "        targ = e.srcElement;\n",
       "    if (targ.nodeType == 3) // defeat Safari bug\n",
       "        targ = targ.parentNode;\n",
       "\n",
       "    // jQuery normalizes the pageX and pageY\n",
       "    // pageX,Y are the mouse positions relative to the document\n",
       "    // offset() returns the position of the element relative to the document\n",
       "    var x = e.pageX - $(targ).offset().left;\n",
       "    var y = e.pageY - $(targ).offset().top;\n",
       "\n",
       "    return {\"x\": x, \"y\": y};\n",
       "};\n",
       "\n",
       "/*\n",
       " * return a copy of an object with only non-object keys\n",
       " * we need this to avoid circular references\n",
       " * http://stackoverflow.com/a/24161582/3208463\n",
       " */\n",
       "function simpleKeys (original) {\n",
       "  return Object.keys(original).reduce(function (obj, key) {\n",
       "    if (typeof original[key] !== 'object')\n",
       "        obj[key] = original[key]\n",
       "    return obj;\n",
       "  }, {});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.mouse_event = function(event, name) {\n",
       "    var canvas_pos = mpl.findpos(event)\n",
       "\n",
       "    if (name === 'button_press')\n",
       "    {\n",
       "        this.canvas.focus();\n",
       "        this.canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    var x = canvas_pos.x * mpl.ratio;\n",
       "    var y = canvas_pos.y * mpl.ratio;\n",
       "\n",
       "    this.send_message(name, {x: x, y: y, button: event.button,\n",
       "                             step: event.step,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "\n",
       "    /* This prevents the web browser from automatically changing to\n",
       "     * the text insertion cursor when the button is pressed.  We want\n",
       "     * to control all of the cursor setting manually through the\n",
       "     * 'cursor' event from matplotlib */\n",
       "    event.preventDefault();\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    // Handle any extra behaviour associated with a key event\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.key_event = function(event, name) {\n",
       "\n",
       "    // Prevent repeat events\n",
       "    if (name == 'key_press')\n",
       "    {\n",
       "        if (event.which === this._key)\n",
       "            return;\n",
       "        else\n",
       "            this._key = event.which;\n",
       "    }\n",
       "    if (name == 'key_release')\n",
       "        this._key = null;\n",
       "\n",
       "    var value = '';\n",
       "    if (event.ctrlKey && event.which != 17)\n",
       "        value += \"ctrl+\";\n",
       "    if (event.altKey && event.which != 18)\n",
       "        value += \"alt+\";\n",
       "    if (event.shiftKey && event.which != 16)\n",
       "        value += \"shift+\";\n",
       "\n",
       "    value += 'k';\n",
       "    value += event.which.toString();\n",
       "\n",
       "    this._key_event_extra(event, name);\n",
       "\n",
       "    this.send_message(name, {key: value,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onclick = function(name) {\n",
       "    if (name == 'download') {\n",
       "        this.handle_save(this, null);\n",
       "    } else {\n",
       "        this.send_message(\"toolbar_button\", {name: name});\n",
       "    }\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
       "    this.message.textContent = tooltip;\n",
       "};\n",
       "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
       "\n",
       "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
       "\n",
       "mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
       "    // Create a \"websocket\"-like object which calls the given IPython comm\n",
       "    // object with the appropriate methods. Currently this is a non binary\n",
       "    // socket, so there is still some room for performance tuning.\n",
       "    var ws = {};\n",
       "\n",
       "    ws.close = function() {\n",
       "        comm.close()\n",
       "    };\n",
       "    ws.send = function(m) {\n",
       "        //console.log('sending', m);\n",
       "        comm.send(m);\n",
       "    };\n",
       "    // Register the callback with on_msg.\n",
       "    comm.on_msg(function(msg) {\n",
       "        //console.log('receiving', msg['content']['data'], msg);\n",
       "        // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
       "        ws.onmessage(msg['content']['data'])\n",
       "    });\n",
       "    return ws;\n",
       "}\n",
       "\n",
       "mpl.mpl_figure_comm = function(comm, msg) {\n",
       "    // This is the function which gets called when the mpl process\n",
       "    // starts-up an IPython Comm through the \"matplotlib\" channel.\n",
       "\n",
       "    var id = msg.content.data.id;\n",
       "    // Get hold of the div created by the display call when the Comm\n",
       "    // socket was opened in Python.\n",
       "    var element = $(\"#\" + id);\n",
       "    var ws_proxy = comm_websocket_adapter(comm)\n",
       "\n",
       "    function ondownload(figure, format) {\n",
       "        window.open(figure.imageObj.src);\n",
       "    }\n",
       "\n",
       "    var fig = new mpl.figure(id, ws_proxy,\n",
       "                           ondownload,\n",
       "                           element.get(0));\n",
       "\n",
       "    // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n",
       "    // web socket which is closed, not our websocket->open comm proxy.\n",
       "    ws_proxy.onopen();\n",
       "\n",
       "    fig.parent_element = element.get(0);\n",
       "    fig.cell_info = mpl.find_output_cell(\"<div id='\" + id + \"'></div>\");\n",
       "    if (!fig.cell_info) {\n",
       "        console.error(\"Failed to find cell for figure\", id, fig);\n",
       "        return;\n",
       "    }\n",
       "\n",
       "    var output_index = fig.cell_info[2]\n",
       "    var cell = fig.cell_info[0];\n",
       "\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.handle_close = function(fig, msg) {\n",
       "    var width = fig.canvas.width/mpl.ratio\n",
       "    fig.root.unbind('remove')\n",
       "\n",
       "    // Update the output cell to use the data from the current canvas.\n",
       "    fig.push_to_output();\n",
       "    var dataURL = fig.canvas.toDataURL();\n",
       "    // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
       "    // the notebook keyboard shortcuts fail.\n",
       "    IPython.keyboard_manager.enable()\n",
       "    $(fig.parent_element).html('<img src=\"' + dataURL + '\" width=\"' + width + '\">');\n",
       "    fig.close_ws(fig, msg);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.close_ws = function(fig, msg){\n",
       "    fig.send_message('closing', msg);\n",
       "    // fig.ws.close()\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
       "    // Turn the data on the canvas into data in the output cell.\n",
       "    var width = this.canvas.width/mpl.ratio\n",
       "    var dataURL = this.canvas.toDataURL();\n",
       "    this.cell_info[1]['text/html'] = '<img src=\"' + dataURL + '\" width=\"' + width + '\">';\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Tell IPython that the notebook contents must change.\n",
       "    IPython.notebook.set_dirty(true);\n",
       "    this.send_message(\"ack\", {});\n",
       "    var fig = this;\n",
       "    // Wait a second, then push the new image to the DOM so\n",
       "    // that it is saved nicely (might be nice to debounce this).\n",
       "    setTimeout(function () { fig.push_to_output() }, 1000);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>');\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items){\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) { continue; };\n",
       "\n",
       "        var button = $('<button class=\"btn btn-default\" href=\"#\" title=\"' + name + '\"><i class=\"fa ' + image + ' fa-lg\"></i></button>');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    // Add the status bar.\n",
       "    var status_bar = $('<span class=\"mpl-message\" style=\"text-align:right; float: right;\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "\n",
       "    // Add the close button to the window.\n",
       "    var buttongrp = $('<div class=\"btn-group inline pull-right\"></div>');\n",
       "    var button = $('<button class=\"btn btn-mini btn-primary\" href=\"#\" title=\"Stop Interaction\"><i class=\"fa fa-power-off icon-remove icon-large\"></i></button>');\n",
       "    button.click(function (evt) { fig.handle_close(fig, {}); } );\n",
       "    button.mouseover('Stop Interaction', toolbar_mouse_event);\n",
       "    buttongrp.append(button);\n",
       "    var titlebar = this.root.find($('.ui-dialog-titlebar'));\n",
       "    titlebar.prepend(buttongrp);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(el){\n",
       "    var fig = this\n",
       "    el.on(\"remove\", function(){\n",
       "\tfig.close_ws(fig, {});\n",
       "    });\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(el){\n",
       "    // this is important to make the div 'focusable\n",
       "    el.attr('tabindex', 0)\n",
       "    // reach out to IPython and tell the keyboard manager to turn it's self\n",
       "    // off when our div gets focus\n",
       "\n",
       "    // location in version 3\n",
       "    if (IPython.notebook.keyboard_manager) {\n",
       "        IPython.notebook.keyboard_manager.register_events(el);\n",
       "    }\n",
       "    else {\n",
       "        // location in version 2\n",
       "        IPython.keyboard_manager.register_events(el);\n",
       "    }\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    var manager = IPython.notebook.keyboard_manager;\n",
       "    if (!manager)\n",
       "        manager = IPython.keyboard_manager;\n",
       "\n",
       "    // Check for shift+enter\n",
       "    if (event.shiftKey && event.which == 13) {\n",
       "        this.canvas_div.blur();\n",
       "        // select the cell after this one\n",
       "        var index = IPython.notebook.find_cell_index(this.cell_info[0]);\n",
       "        IPython.notebook.select(index + 1);\n",
       "    }\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    fig.ondownload(fig, null);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.find_output_cell = function(html_output) {\n",
       "    // Return the cell and output element which can be found *uniquely* in the notebook.\n",
       "    // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n",
       "    // IPython event is triggered only after the cells have been serialised, which for\n",
       "    // our purposes (turning an active figure into a static one), is too late.\n",
       "    var cells = IPython.notebook.get_cells();\n",
       "    var ncells = cells.length;\n",
       "    for (var i=0; i<ncells; i++) {\n",
       "        var cell = cells[i];\n",
       "        if (cell.cell_type === 'code'){\n",
       "            for (var j=0; j<cell.output_area.outputs.length; j++) {\n",
       "                var data = cell.output_area.outputs[j];\n",
       "                if (data.data) {\n",
       "                    // IPython >= 3 moved mimebundle to data attribute of output\n",
       "                    data = data.data;\n",
       "                }\n",
       "                if (data['text/html'] == html_output) {\n",
       "                    return [cell, data, j];\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "}\n",
       "\n",
       "// Register the function which deals with the matplotlib target/channel.\n",
       "// The kernel may be null if the page has been refreshed.\n",
       "if (IPython.notebook.kernel != null) {\n",
       "    IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n",
       "}\n"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<img src=\"\" width=\"596\">"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib notebook\n",
    "s = np.linspace(-1, 1, 10)\n",
    "t = np.linspace(-1, 1, 10)\n",
    "S, T = np.meshgrid(s, t)\n",
    "\n",
    "X = S\n",
    "Y = T\n",
    "Z = T*.25\n",
    "\n",
    "fig = plt.figure(figsize = (8,8))\n",
    "\n",
    "ax = fig.add_subplot(111,projection='3d')\n",
    "ax.plot_surface(X, Y, Z, alpha = .9, cmap=plt.cm.coolwarm)\n",
    "\n",
    "x3 = np.linspace(-1, 1, 10)\n",
    "x1 = 0*x3\n",
    "x2 = -.25*x3\n",
    "ax.plot(x1,x2,x3, lw = 5)\n",
    "\n",
    "ax.set_xlabel('x-axis', size = 18)\n",
    "ax.set_ylabel('y-axis', size = 18)\n",
    "ax.set_zlabel('z-axis', size = 18)\n",
    "\n",
    "ax.axis([-1,1,-1,1])\n",
    "\n",
    "ax.text(x = 1, y = -1, z = -.25, s = r'$Row\\ A$', size = 17)\n",
    "ax.text(0, -.25, 1, s = r'$Nul\\ A$', size = 17)\n",
    "\n",
    "ax.view_init(7, 20)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##  <font face=\"gotham\" color=\"purple\"> $\\text{Nul}A^T \\perp \\text{Col}A$  </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The nullity of $A^T$ is"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAMYAAABLCAYAAAArtfhbAAAACXBIWXMAAA7EAAAOxAGVKw4bAAANLklEQVR4Ae2d7Y3dthKGdxf+HSxi4P7PuoN1XEGcDhKnght3EMMVBE4HTiq4N+7A6cDX7sAu4AKxF/kdwHkfLkdL6VDfpHSORAI6kvgxQ76a4QxFiuf88+fPZ0PC+fn5W+V7pvx/xPIr/Vrx5ImFVyr3fSyhxN0hIAzf6+7qLubuSvid392VqzEICFcwfa3joXC8GVL23pBMIvxS+T60KUWDxi+65wGH4UN4U65bEXgRSflWcd9F4kvUQAQktx8kw6+U/TcdgzrocxXqJC+CPBQIftWlbcpnFuMBFekkWhIHIyBcf1Tml8K0WIzBqMUzCstPSsHr+TWe4y6202KI0KWyohQQG2SC7kh3X3lF+l25Bpu3bor9qeKJSX3mc36t80fu1bZ3Pi7rSfzNIvwpRg90vBDv0olkRb1GHGvxWs/hjz7cOxVDRFAKXKheDauxb7lRhUzREEgEM+pPtxSfFe2VAkGsTKkX1Lc6f6v46NhpFtOgsHgw/vpZfDDpZ7oHC+NdlANQMgeesXAHf4YGuKjtQZnPYodK4BrhZz2OpTfjgvxXzbTYvfL/5OlfxtJTx4kX1umAl+Iwr59S8wvpiT7u0PswjmsFLMjrZnx4r3TKKir+nEr8OFyEJZ0x4H/Xhd2FMrQFrMU7Fc7ak7YxzxD/WDQ/+Z46JE/7LhWf03phpWLu2hvFP47UKaxfuU6IgOQZ68wzN7c2Sj2qGHpQDLixGOaPRwufWCRg4Ba2jZVwbXIFlBL3sRmsLqSXsBwCyPWV5ByvJRqiiqGcz3UMfT0bJXxskVKI73Uw4G0GOgB8lViP3sw7+n6gNfhyNOFSYDIC/lnTUSLn0XCgGHqQCAoHA5RNB99WXKicltGE3qxDiKlZkZzWKuRXru8QQL5xofGODsKBYiiHaVGSN1EHHI8rggH5r+pBmJRcM9xfk/keeeu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CwEiiEsxoWX84FgY0g8Fzt4P81WjvwqGLQeBXCnUJBIFJCQWATCHhrgSvV6Qm1KoZHgb+RxWrEXrFuAqjSiP0gIDlGIXCherfZ6VQMWQ3e73LM2XBLxUsoCBwFAr+pFvwbU/wVbVDFTsUgn4jwHQPbNOaa9AuqUy4LAnkQkPwyL8cxaKfCXsXw1YTYC2+KfFTr6b3yfW4cttSktVBJcJ+/HmAnXIq1TiMc4MhfIzNu7g1t8xi1giL2ToKOcrB0o40wI/y2nbFbR/81RuUG/7eExAj4Dp1xxeAlR/8ASd06KeRzmS0AAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left( \\left[\\begin{matrix}1 & 2 & 0\\\\0 & 0 & 1\\\\0 & 0 & 0\\end{matrix}\\right], \\  \\left( 0, \\  2\\right)\\right)$"
      ],
      "text/plain": [
       "⎛⎡1  2  0⎤        ⎞\n",
       "⎜⎢       ⎥        ⎟\n",
       "⎜⎢0  0  1⎥, (0, 2)⎟\n",
       "⎜⎢       ⎥        ⎟\n",
       "⎝⎣0  0  0⎦        ⎠"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = sy.Matrix([[5, 8, 2], [10, 16, 4], [3, 4, 1]]);A.T.rref()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The $\\text{Nul}A^T$ is \n",
    "\n",
    "$$\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "x_1 \\\\ x_2\\\\ x_3\n",
    "\\end{matrix}\n",
    "\\right]=\n",
    "x_2\n",
    "\\left[\n",
    "\\begin{matrix}\n",
    "-2 \\\\ 1\\\\ 0\n",
    "\\end{matrix}\n",
    "\\right]\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The  $\\text{Col}A$ is "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBOR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tMIB2ZW59FDrUIibcKaMZdP9dBtcYWBo2DglVrxVn08vexba2KrkJBOhfANBMdbzvWCsQan3BYG5mdAfZl3gFz07U7XKSSxBAp7HlVUV6EflO7LxsU6dHEDGBB/Wzwqe9HoAzhsSQqPD6UAmHN3ul3vSRoZVdh7PTQEhe0juwpm2XfXqeNlSbjBaK8f2MvFTcyA+jFzEeYhvbdA/R/gxzySq7jb6QAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left( \\left[\\begin{matrix}1 & 0 & 0\\\\0 & 1 & \\frac{1}{4}\\\\0 & 0 & 0\\end{matrix}\\right], \\  \\left( 0, \\  1\\right)\\right)$"
      ],
      "text/plain": [
       "⎛⎡1  0   0 ⎤        ⎞\n",
       "⎜⎢         ⎥        ⎟\n",
       "⎜⎢0  1  1/4⎥, (0, 1)⎟\n",
       "⎜⎢         ⎥        ⎟\n",
       "⎝⎣0  0   0 ⎦        ⎠"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A.rref()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$$\n",
    "\\text{Col}A=\n",
    "s\\left[\n",
    "\\begin{matrix}\n",
    "5 \\\\ 10\\\\ 3\n",
    "\\end{matrix}\n",
    "\\right]+\n",
    "t\\left[\n",
    "\\begin{matrix}\n",
    "8 \\\\ 16\\\\ 4\n",
    "\\end{matrix}\n",
    "\\right]\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\text{Col}A$ is a plane and $\\text{Nul}A^T$ is a line perpendicular to the plane. The intuition is similar to $\\text{Nul}A \\perp \\text{Row}A$, here you can think of a system look like $b^TA = \\mathbf{0}^T$."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "/* Put everything inside the global mpl namespace */\n",
       "window.mpl = {};\n",
       "\n",
       "\n",
       "mpl.get_websocket_type = function() {\n",
       "    if (typeof(WebSocket) !== 'undefined') {\n",
       "        return WebSocket;\n",
       "    } else if (typeof(MozWebSocket) !== 'undefined') {\n",
       "        return MozWebSocket;\n",
       "    } else {\n",
       "        alert('Your browser does not have WebSocket support. ' +\n",
       "              'Please try Chrome, Safari or Firefox ≥ 6. ' +\n",
       "              'Firefox 4 and 5 are also supported but you ' +\n",
       "              'have to enable WebSockets in about:config.');\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n",
       "    this.id = figure_id;\n",
       "\n",
       "    this.ws = websocket;\n",
       "\n",
       "    this.supports_binary = (this.ws.binaryType != undefined);\n",
       "\n",
       "    if (!this.supports_binary) {\n",
       "        var warnings = document.getElementById(\"mpl-warnings\");\n",
       "        if (warnings) {\n",
       "            warnings.style.display = 'block';\n",
       "            warnings.textContent = (\n",
       "                \"This browser does not support binary websocket messages. \" +\n",
       "                    \"Performance may be slow.\");\n",
       "        }\n",
       "    }\n",
       "\n",
       "    this.imageObj = new Image();\n",
       "\n",
       "    this.context = undefined;\n",
       "    this.message = undefined;\n",
       "    this.canvas = undefined;\n",
       "    this.rubberband_canvas = undefined;\n",
       "    this.rubberband_context = undefined;\n",
       "    this.format_dropdown = undefined;\n",
       "\n",
       "    this.image_mode = 'full';\n",
       "\n",
       "    this.root = $('<div/>');\n",
       "    this._root_extra_style(this.root)\n",
       "    this.root.attr('style', 'display: inline-block');\n",
       "\n",
       "    $(parent_element).append(this.root);\n",
       "\n",
       "    this._init_header(this);\n",
       "    this._init_canvas(this);\n",
       "    this._init_toolbar(this);\n",
       "\n",
       "    var fig = this;\n",
       "\n",
       "    this.waiting = false;\n",
       "\n",
       "    this.ws.onopen =  function () {\n",
       "            fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
       "            fig.send_message(\"send_image_mode\", {});\n",
       "            if (mpl.ratio != 1) {\n",
       "                fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
       "            }\n",
       "            fig.send_message(\"refresh\", {});\n",
       "        }\n",
       "\n",
       "    this.imageObj.onload = function() {\n",
       "            if (fig.image_mode == 'full') {\n",
       "                // Full images could contain transparency (where diff images\n",
       "                // almost always do), so we need to clear the canvas so that\n",
       "                // there is no ghosting.\n",
       "                fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n",
       "            }\n",
       "            fig.context.drawImage(fig.imageObj, 0, 0);\n",
       "        };\n",
       "\n",
       "    this.imageObj.onunload = function() {\n",
       "        fig.ws.close();\n",
       "    }\n",
       "\n",
       "    this.ws.onmessage = this._make_on_message_function(this);\n",
       "\n",
       "    this.ondownload = ondownload;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_header = function() {\n",
       "    var titlebar = $(\n",
       "        '<div class=\"ui-dialog-titlebar ui-widget-header ui-corner-all ' +\n",
       "        'ui-helper-clearfix\"/>');\n",
       "    var titletext = $(\n",
       "        '<div class=\"ui-dialog-title\" style=\"width: 100%; ' +\n",
       "        'text-align: center; padding: 3px;\"/>');\n",
       "    titlebar.append(titletext)\n",
       "    this.root.append(titlebar);\n",
       "    this.header = titletext[0];\n",
       "}\n",
       "\n",
       "\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_canvas = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var canvas_div = $('<div/>');\n",
       "\n",
       "    canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n",
       "\n",
       "    function canvas_keyboard_event(event) {\n",
       "        return fig.key_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    canvas_div.keydown('key_press', canvas_keyboard_event);\n",
       "    canvas_div.keyup('key_release', canvas_keyboard_event);\n",
       "    this.canvas_div = canvas_div\n",
       "    this._canvas_extra_style(canvas_div)\n",
       "    this.root.append(canvas_div);\n",
       "\n",
       "    var canvas = $('<canvas/>');\n",
       "    canvas.addClass('mpl-canvas');\n",
       "    canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n",
       "\n",
       "    this.canvas = canvas[0];\n",
       "    this.context = canvas[0].getContext(\"2d\");\n",
       "\n",
       "    var backingStore = this.context.backingStorePixelRatio ||\n",
       "\tthis.context.webkitBackingStorePixelRatio ||\n",
       "\tthis.context.mozBackingStorePixelRatio ||\n",
       "\tthis.context.msBackingStorePixelRatio ||\n",
       "\tthis.context.oBackingStorePixelRatio ||\n",
       "\tthis.context.backingStorePixelRatio || 1;\n",
       "\n",
       "    mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
       "\n",
       "    var rubberband = $('<canvas/>');\n",
       "    rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
       "\n",
       "    var pass_mouse_events = true;\n",
       "\n",
       "    canvas_div.resizable({\n",
       "        start: function(event, ui) {\n",
       "            pass_mouse_events = false;\n",
       "        },\n",
       "        resize: function(event, ui) {\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "        stop: function(event, ui) {\n",
       "            pass_mouse_events = true;\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "    });\n",
       "\n",
       "    function mouse_event_fn(event) {\n",
       "        if (pass_mouse_events)\n",
       "            return fig.mouse_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    rubberband.mousedown('button_press', mouse_event_fn);\n",
       "    rubberband.mouseup('button_release', mouse_event_fn);\n",
       "    // Throttle sequential mouse events to 1 every 20ms.\n",
       "    rubberband.mousemove('motion_notify', mouse_event_fn);\n",
       "\n",
       "    rubberband.mouseenter('figure_enter', mouse_event_fn);\n",
       "    rubberband.mouseleave('figure_leave', mouse_event_fn);\n",
       "\n",
       "    canvas_div.on(\"wheel\", function (event) {\n",
       "        event = event.originalEvent;\n",
       "        event['data'] = 'scroll'\n",
       "        if (event.deltaY < 0) {\n",
       "            event.step = 1;\n",
       "        } else {\n",
       "            event.step = -1;\n",
       "        }\n",
       "        mouse_event_fn(event);\n",
       "    });\n",
       "\n",
       "    canvas_div.append(canvas);\n",
       "    canvas_div.append(rubberband);\n",
       "\n",
       "    this.rubberband = rubberband;\n",
       "    this.rubberband_canvas = rubberband[0];\n",
       "    this.rubberband_context = rubberband[0].getContext(\"2d\");\n",
       "    this.rubberband_context.strokeStyle = \"#000000\";\n",
       "\n",
       "    this._resize_canvas = function(width, height) {\n",
       "        // Keep the size of the canvas, canvas container, and rubber band\n",
       "        // canvas in synch.\n",
       "        canvas_div.css('width', width)\n",
       "        canvas_div.css('height', height)\n",
       "\n",
       "        canvas.attr('width', width * mpl.ratio);\n",
       "        canvas.attr('height', height * mpl.ratio);\n",
       "        canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
       "\n",
       "        rubberband.attr('width', width);\n",
       "        rubberband.attr('height', height);\n",
       "    }\n",
       "\n",
       "    // Set the figure to an initial 600x600px, this will subsequently be updated\n",
       "    // upon first draw.\n",
       "    this._resize_canvas(600, 600);\n",
       "\n",
       "    // Disable right mouse context menu.\n",
       "    $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n",
       "        return false;\n",
       "    });\n",
       "\n",
       "    function set_focus () {\n",
       "        canvas.focus();\n",
       "        canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    window.setTimeout(set_focus, 100);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>');\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items) {\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) {\n",
       "            // put a spacer in here.\n",
       "            continue;\n",
       "        }\n",
       "        var button = $('<button/>');\n",
       "        button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n",
       "                        'ui-button-icon-only');\n",
       "        button.attr('role', 'button');\n",
       "        button.attr('aria-disabled', 'false');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "\n",
       "        var icon_img = $('<span/>');\n",
       "        icon_img.addClass('ui-button-icon-primary ui-icon');\n",
       "        icon_img.addClass(image);\n",
       "        icon_img.addClass('ui-corner-all');\n",
       "\n",
       "        var tooltip_span = $('<span/>');\n",
       "        tooltip_span.addClass('ui-button-text');\n",
       "        tooltip_span.html(tooltip);\n",
       "\n",
       "        button.append(icon_img);\n",
       "        button.append(tooltip_span);\n",
       "\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    var fmt_picker_span = $('<span/>');\n",
       "\n",
       "    var fmt_picker = $('<select/>');\n",
       "    fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n",
       "    fmt_picker_span.append(fmt_picker);\n",
       "    nav_element.append(fmt_picker_span);\n",
       "    this.format_dropdown = fmt_picker[0];\n",
       "\n",
       "    for (var ind in mpl.extensions) {\n",
       "        var fmt = mpl.extensions[ind];\n",
       "        var option = $(\n",
       "            '<option/>', {selected: fmt === mpl.default_extension}).html(fmt);\n",
       "        fmt_picker.append(option);\n",
       "    }\n",
       "\n",
       "    // Add hover states to the ui-buttons\n",
       "    $( \".ui-button\" ).hover(\n",
       "        function() { $(this).addClass(\"ui-state-hover\");},\n",
       "        function() { $(this).removeClass(\"ui-state-hover\");}\n",
       "    );\n",
       "\n",
       "    var status_bar = $('<span class=\"mpl-message\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n",
       "    // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n",
       "    // which will in turn request a refresh of the image.\n",
       "    this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_message = function(type, properties) {\n",
       "    properties['type'] = type;\n",
       "    properties['figure_id'] = this.id;\n",
       "    this.ws.send(JSON.stringify(properties));\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_draw_message = function() {\n",
       "    if (!this.waiting) {\n",
       "        this.waiting = true;\n",
       "        this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n",
       "    }\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    var format_dropdown = fig.format_dropdown;\n",
       "    var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n",
       "    fig.ondownload(fig, format);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_resize = function(fig, msg) {\n",
       "    var size = msg['size'];\n",
       "    if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n",
       "        fig._resize_canvas(size[0], size[1]);\n",
       "        fig.send_message(\"refresh\", {});\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
       "    var x0 = msg['x0'] / mpl.ratio;\n",
       "    var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
       "    var x1 = msg['x1'] / mpl.ratio;\n",
       "    var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
       "    x0 = Math.floor(x0) + 0.5;\n",
       "    y0 = Math.floor(y0) + 0.5;\n",
       "    x1 = Math.floor(x1) + 0.5;\n",
       "    y1 = Math.floor(y1) + 0.5;\n",
       "    var min_x = Math.min(x0, x1);\n",
       "    var min_y = Math.min(y0, y1);\n",
       "    var width = Math.abs(x1 - x0);\n",
       "    var height = Math.abs(y1 - y0);\n",
       "\n",
       "    fig.rubberband_context.clearRect(\n",
       "        0, 0, fig.canvas.width / mpl.ratio, fig.canvas.height / mpl.ratio);\n",
       "\n",
       "    fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_figure_label = function(fig, msg) {\n",
       "    // Updates the figure title.\n",
       "    fig.header.textContent = msg['label'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_cursor = function(fig, msg) {\n",
       "    var cursor = msg['cursor'];\n",
       "    switch(cursor)\n",
       "    {\n",
       "    case 0:\n",
       "        cursor = 'pointer';\n",
       "        break;\n",
       "    case 1:\n",
       "        cursor = 'default';\n",
       "        break;\n",
       "    case 2:\n",
       "        cursor = 'crosshair';\n",
       "        break;\n",
       "    case 3:\n",
       "        cursor = 'move';\n",
       "        break;\n",
       "    }\n",
       "    fig.rubberband_canvas.style.cursor = cursor;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_message = function(fig, msg) {\n",
       "    fig.message.textContent = msg['message'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_draw = function(fig, msg) {\n",
       "    // Request the server to send over a new figure.\n",
       "    fig.send_draw_message();\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_image_mode = function(fig, msg) {\n",
       "    fig.image_mode = msg['mode'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Called whenever the canvas gets updated.\n",
       "    this.send_message(\"ack\", {});\n",
       "}\n",
       "\n",
       "// A function to construct a web socket function for onmessage handling.\n",
       "// Called in the figure constructor.\n",
       "mpl.figure.prototype._make_on_message_function = function(fig) {\n",
       "    return function socket_on_message(evt) {\n",
       "        if (evt.data instanceof Blob) {\n",
       "            /* FIXME: We get \"Resource interpreted as Image but\n",
       "             * transferred with MIME type text/plain:\" errors on\n",
       "             * Chrome.  But how to set the MIME type?  It doesn't seem\n",
       "             * to be part of the websocket stream */\n",
       "            evt.data.type = \"image/png\";\n",
       "\n",
       "            /* Free the memory for the previous frames */\n",
       "            if (fig.imageObj.src) {\n",
       "                (window.URL || window.webkitURL).revokeObjectURL(\n",
       "                    fig.imageObj.src);\n",
       "            }\n",
       "\n",
       "            fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n",
       "                evt.data);\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "        else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n",
       "            fig.imageObj.src = evt.data;\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        var msg = JSON.parse(evt.data);\n",
       "        var msg_type = msg['type'];\n",
       "\n",
       "        // Call the  \"handle_{type}\" callback, which takes\n",
       "        // the figure and JSON message as its only arguments.\n",
       "        try {\n",
       "            var callback = fig[\"handle_\" + msg_type];\n",
       "        } catch (e) {\n",
       "            console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        if (callback) {\n",
       "            try {\n",
       "                // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n",
       "                callback(fig, msg);\n",
       "            } catch (e) {\n",
       "                console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n",
       "            }\n",
       "        }\n",
       "    };\n",
       "}\n",
       "\n",
       "// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n",
       "mpl.findpos = function(e) {\n",
       "    //this section is from http://www.quirksmode.org/js/events_properties.html\n",
       "    var targ;\n",
       "    if (!e)\n",
       "        e = window.event;\n",
       "    if (e.target)\n",
       "        targ = e.target;\n",
       "    else if (e.srcElement)\n",
       "        targ = e.srcElement;\n",
       "    if (targ.nodeType == 3) // defeat Safari bug\n",
       "        targ = targ.parentNode;\n",
       "\n",
       "    // jQuery normalizes the pageX and pageY\n",
       "    // pageX,Y are the mouse positions relative to the document\n",
       "    // offset() returns the position of the element relative to the document\n",
       "    var x = e.pageX - $(targ).offset().left;\n",
       "    var y = e.pageY - $(targ).offset().top;\n",
       "\n",
       "    return {\"x\": x, \"y\": y};\n",
       "};\n",
       "\n",
       "/*\n",
       " * return a copy of an object with only non-object keys\n",
       " * we need this to avoid circular references\n",
       " * http://stackoverflow.com/a/24161582/3208463\n",
       " */\n",
       "function simpleKeys (original) {\n",
       "  return Object.keys(original).reduce(function (obj, key) {\n",
       "    if (typeof original[key] !== 'object')\n",
       "        obj[key] = original[key]\n",
       "    return obj;\n",
       "  }, {});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.mouse_event = function(event, name) {\n",
       "    var canvas_pos = mpl.findpos(event)\n",
       "\n",
       "    if (name === 'button_press')\n",
       "    {\n",
       "        this.canvas.focus();\n",
       "        this.canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    var x = canvas_pos.x * mpl.ratio;\n",
       "    var y = canvas_pos.y * mpl.ratio;\n",
       "\n",
       "    this.send_message(name, {x: x, y: y, button: event.button,\n",
       "                             step: event.step,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "\n",
       "    /* This prevents the web browser from automatically changing to\n",
       "     * the text insertion cursor when the button is pressed.  We want\n",
       "     * to control all of the cursor setting manually through the\n",
       "     * 'cursor' event from matplotlib */\n",
       "    event.preventDefault();\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    // Handle any extra behaviour associated with a key event\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.key_event = function(event, name) {\n",
       "\n",
       "    // Prevent repeat events\n",
       "    if (name == 'key_press')\n",
       "    {\n",
       "        if (event.which === this._key)\n",
       "            return;\n",
       "        else\n",
       "            this._key = event.which;\n",
       "    }\n",
       "    if (name == 'key_release')\n",
       "        this._key = null;\n",
       "\n",
       "    var value = '';\n",
       "    if (event.ctrlKey && event.which != 17)\n",
       "        value += \"ctrl+\";\n",
       "    if (event.altKey && event.which != 18)\n",
       "        value += \"alt+\";\n",
       "    if (event.shiftKey && event.which != 16)\n",
       "        value += \"shift+\";\n",
       "\n",
       "    value += 'k';\n",
       "    value += event.which.toString();\n",
       "\n",
       "    this._key_event_extra(event, name);\n",
       "\n",
       "    this.send_message(name, {key: value,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onclick = function(name) {\n",
       "    if (name == 'download') {\n",
       "        this.handle_save(this, null);\n",
       "    } else {\n",
       "        this.send_message(\"toolbar_button\", {name: name});\n",
       "    }\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
       "    this.message.textContent = tooltip;\n",
       "};\n",
       "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
       "\n",
       "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
       "\n",
       "mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
       "    // Create a \"websocket\"-like object which calls the given IPython comm\n",
       "    // object with the appropriate methods. Currently this is a non binary\n",
       "    // socket, so there is still some room for performance tuning.\n",
       "    var ws = {};\n",
       "\n",
       "    ws.close = function() {\n",
       "        comm.close()\n",
       "    };\n",
       "    ws.send = function(m) {\n",
       "        //console.log('sending', m);\n",
       "        comm.send(m);\n",
       "    };\n",
       "    // Register the callback with on_msg.\n",
       "    comm.on_msg(function(msg) {\n",
       "        //console.log('receiving', msg['content']['data'], msg);\n",
       "        // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
       "        ws.onmessage(msg['content']['data'])\n",
       "    });\n",
       "    return ws;\n",
       "}\n",
       "\n",
       "mpl.mpl_figure_comm = function(comm, msg) {\n",
       "    // This is the function which gets called when the mpl process\n",
       "    // starts-up an IPython Comm through the \"matplotlib\" channel.\n",
       "\n",
       "    var id = msg.content.data.id;\n",
       "    // Get hold of the div created by the display call when the Comm\n",
       "    // socket was opened in Python.\n",
       "    var element = $(\"#\" + id);\n",
       "    var ws_proxy = comm_websocket_adapter(comm)\n",
       "\n",
       "    function ondownload(figure, format) {\n",
       "        window.open(figure.imageObj.src);\n",
       "    }\n",
       "\n",
       "    var fig = new mpl.figure(id, ws_proxy,\n",
       "                           ondownload,\n",
       "                           element.get(0));\n",
       "\n",
       "    // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n",
       "    // web socket which is closed, not our websocket->open comm proxy.\n",
       "    ws_proxy.onopen();\n",
       "\n",
       "    fig.parent_element = element.get(0);\n",
       "    fig.cell_info = mpl.find_output_cell(\"<div id='\" + id + \"'></div>\");\n",
       "    if (!fig.cell_info) {\n",
       "        console.error(\"Failed to find cell for figure\", id, fig);\n",
       "        return;\n",
       "    }\n",
       "\n",
       "    var output_index = fig.cell_info[2]\n",
       "    var cell = fig.cell_info[0];\n",
       "\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.handle_close = function(fig, msg) {\n",
       "    var width = fig.canvas.width/mpl.ratio\n",
       "    fig.root.unbind('remove')\n",
       "\n",
       "    // Update the output cell to use the data from the current canvas.\n",
       "    fig.push_to_output();\n",
       "    var dataURL = fig.canvas.toDataURL();\n",
       "    // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
       "    // the notebook keyboard shortcuts fail.\n",
       "    IPython.keyboard_manager.enable()\n",
       "    $(fig.parent_element).html('<img src=\"' + dataURL + '\" width=\"' + width + '\">');\n",
       "    fig.close_ws(fig, msg);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.close_ws = function(fig, msg){\n",
       "    fig.send_message('closing', msg);\n",
       "    // fig.ws.close()\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
       "    // Turn the data on the canvas into data in the output cell.\n",
       "    var width = this.canvas.width/mpl.ratio\n",
       "    var dataURL = this.canvas.toDataURL();\n",
       "    this.cell_info[1]['text/html'] = '<img src=\"' + dataURL + '\" width=\"' + width + '\">';\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Tell IPython that the notebook contents must change.\n",
       "    IPython.notebook.set_dirty(true);\n",
       "    this.send_message(\"ack\", {});\n",
       "    var fig = this;\n",
       "    // Wait a second, then push the new image to the DOM so\n",
       "    // that it is saved nicely (might be nice to debounce this).\n",
       "    setTimeout(function () { fig.push_to_output() }, 1000);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>');\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items){\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) { continue; };\n",
       "\n",
       "        var button = $('<button class=\"btn btn-default\" href=\"#\" title=\"' + name + '\"><i class=\"fa ' + image + ' fa-lg\"></i></button>');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    // Add the status bar.\n",
       "    var status_bar = $('<span class=\"mpl-message\" style=\"text-align:right; float: right;\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "\n",
       "    // Add the close button to the window.\n",
       "    var buttongrp = $('<div class=\"btn-group inline pull-right\"></div>');\n",
       "    var button = $('<button class=\"btn btn-mini btn-primary\" href=\"#\" title=\"Stop Interaction\"><i class=\"fa fa-power-off icon-remove icon-large\"></i></button>');\n",
       "    button.click(function (evt) { fig.handle_close(fig, {}); } );\n",
       "    button.mouseover('Stop Interaction', toolbar_mouse_event);\n",
       "    buttongrp.append(button);\n",
       "    var titlebar = this.root.find($('.ui-dialog-titlebar'));\n",
       "    titlebar.prepend(buttongrp);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(el){\n",
       "    var fig = this\n",
       "    el.on(\"remove\", function(){\n",
       "\tfig.close_ws(fig, {});\n",
       "    });\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(el){\n",
       "    // this is important to make the div 'focusable\n",
       "    el.attr('tabindex', 0)\n",
       "    // reach out to IPython and tell the keyboard manager to turn it's self\n",
       "    // off when our div gets focus\n",
       "\n",
       "    // location in version 3\n",
       "    if (IPython.notebook.keyboard_manager) {\n",
       "        IPython.notebook.keyboard_manager.register_events(el);\n",
       "    }\n",
       "    else {\n",
       "        // location in version 2\n",
       "        IPython.keyboard_manager.register_events(el);\n",
       "    }\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    var manager = IPython.notebook.keyboard_manager;\n",
       "    if (!manager)\n",
       "        manager = IPython.keyboard_manager;\n",
       "\n",
       "    // Check for shift+enter\n",
       "    if (event.shiftKey && event.which == 13) {\n",
       "        this.canvas_div.blur();\n",
       "        // select the cell after this one\n",
       "        var index = IPython.notebook.find_cell_index(this.cell_info[0]);\n",
       "        IPython.notebook.select(index + 1);\n",
       "    }\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    fig.ondownload(fig, null);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.find_output_cell = function(html_output) {\n",
       "    // Return the cell and output element which can be found *uniquely* in the notebook.\n",
       "    // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n",
       "    // IPython event is triggered only after the cells have been serialised, which for\n",
       "    // our purposes (turning an active figure into a static one), is too late.\n",
       "    var cells = IPython.notebook.get_cells();\n",
       "    var ncells = cells.length;\n",
       "    for (var i=0; i<ncells; i++) {\n",
       "        var cell = cells[i];\n",
       "        if (cell.cell_type === 'code'){\n",
       "            for (var j=0; j<cell.output_area.outputs.length; j++) {\n",
       "                var data = cell.output_area.outputs[j];\n",
       "                if (data.data) {\n",
       "                    // IPython >= 3 moved mimebundle to data attribute of output\n",
       "                    data = data.data;\n",
       "                }\n",
       "                if (data['text/html'] == html_output) {\n",
       "                    return [cell, data, j];\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "}\n",
       "\n",
       "// Register the function which deals with the matplotlib target/channel.\n",
       "// The kernel may be null if the page has been refreshed.\n",
       "if (IPython.notebook.kernel != null) {\n",
       "    IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n",
       "}\n"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<img src=\"\" width=\"800\">"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib notebook\n",
    "s = np.linspace(-1, 1, 10)\n",
    "t = np.linspace(-1, 1, 10)\n",
    "S, T = np.meshgrid(s, t)\n",
    "\n",
    "X = 5*S+8*T\n",
    "Y = 10*S+16*T\n",
    "Z = 3*S+4*T\n",
    "\n",
    "fig = plt.figure(figsize = (8,8))\n",
    "\n",
    "ax = fig.add_subplot(111,projection='3d')\n",
    "ax.plot_surface(X, Y, Z, cmap=plt.cm.coolwarm)\n",
    "\n",
    "x2 = np.linspace(-1, 1, 10)\n",
    "x3 = x2*0\n",
    "x1 = -2*x2\n",
    "\n",
    "ax.plot(x1,x2,x3, lw = 3)\n",
    "\n",
    "ax.set_xlabel('x-axis', size = 18)\n",
    "ax.set_ylabel('y-axis', size = 18)\n",
    "ax.set_zlabel('z-axis', size = 18)\n",
    "\n",
    "ax.axis([-1,1,-1,1])\n",
    "\n",
    "ax.view_init(-67, 35)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# <font face=\"gotham\" color=\"purple\"> Rank Decomposition </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Consider a matrix $A$, the purpose is to decompose it into the multiplication of $C$, $R$, which are the  bases of column space and row space respectively."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$$\n",
    "A = CR\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAKgAAABkCAYAAAASYXt7AAAACXBIWXMAAA7EAAAOxAGVKw4bAAALS0lEQVR4Ae2d75HVNhTFd5l8zsBmJt9ZOoBsB0sHZFIBoQOYlAAdQCog0AFQAVk6WArITGAnDWzOz0jGz8/eJ9vy85Xf1YyfbfmPzj06lq5sSe/46OjovpYLLV3h7fX19a9dBzzOGcjBwPHx8aXuc9p1L2nv+IfGgRfa5uRm+Nzc8W1nYAYGnnfc86HiHhHfFOhLKdYF2cGWR83HgDT3qn13lapEVQK91T7Yt6+LTrW8D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xAg5rBdWaioGXdbiVFzl+ytuUgFRvA8KOVo23sUFcqjuszjqOTJx6D3Cg8XDNevECENxtc8X1/A824QeayhBeVLbDSF8ISYOKPL9Z0MEWw8YD6SOU7pmmRihkdbgzVAQ0Ch6r+3m2PgTxfF+dHJDKVmgAlB91lLCVJ0EWpII4GMOINUdR/yQtnDQMPpDa+5A5pnpTAGgsUG2zT4xwlhs4To0QQHR9cUuS+HgEzdMzCG/PD8DKmgQvE/ckJ9av2NuBopvJOUmxO9niwEXqK38cDQtBlygLUJ81xYDLlBb+eFoWgw0XzPx1yatw9VL4r4uVe1zfd8ZGMyANMdwndO+CxEon6LqT1StEyd9pmrdy3edgS4G6N/aG/4HoP6/MBMUQaAAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}2 & 4 & 1 & -1\\\\4 & 2 & -4 & 2\\\\2 & -2 & -5 & 3\\\\1 & 9 & -3 & 2\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡2  4   1   -1⎤\n",
       "⎢             ⎥\n",
       "⎢4  2   -4  2 ⎥\n",
       "⎢             ⎥\n",
       "⎢2  -2  -5  3 ⎥\n",
       "⎢             ⎥\n",
       "⎣1  9   -3  2 ⎦"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = sy.Matrix([[2, 4, 1, -1], [4, 2, -4, 2], [2, -2, -5, 3], [1, 9, -3, 2]]);A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAARsAAABlCAYAAAB9ckckAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAVI0lEQVR4Ae2dTc7VyBWGATHKICIgRZkGoizg62bWs6azAiBS5g07oMUKUPcOgHmkbnoFgZ5l1g0LiALjKFLgUxYQ8j711TG2b/na13a5rq9PSXWvXT/n563yqVPlsn3548ePlzw4AnMgcPny5d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MgtF2lwBzym1cZCdy0t8N2qLvMe2Xcm2Giuz1yuIQJxCsQQTviO2I4osEK93bEQV4rvOL9rp+85VHibUu9lTjhfp3LUyOmYK9UHxzNJy/YvHJnmPxXNJvMQLb1qiNvuin68HD7UfAxQ24Fqq3a4qIxV4Z8kjWSoqnacKTEjDi9ncd6Okc0m9xzbXGmUeq6vXm4AAtkLVeb7yxy6bcRkL1A6xIt7Gd8of9I2n6ELxkOUt1cmy0NuW089PBwH1Hzybp+o7l09Hq+1oovZ7JG15m0Pn9d9YIDZo1OB4MxiZ4N1Yuv87Ao6AI9CBwGOlP9vnaCSNDcRUiakURgciHhwBR8ARSCIQvRqmUXtnQZ3GJlL9Wv94N6nb1UnGnugIOALbQUC2ASPD9OlhnBF1Kr/X2Kgy98qJTzspeIYj4AhsGYHnUp5vvqdvd9eQ2WtsKCcivNfkpixYro1+NXH80BFwBNaCgGwCe/GI2Ije0GtsIgWI8RF5XKa+8FblPraiPQbRV9fzN4CA+sZOH5Ha7j2vr+1ps3t90ydTq2ufjeWHfxF7ow6CweGxAhaNU4Hb3Q9TGUrzW+EdwGw0mTm+hxUjIHuA48E6zeBHjP4P3KKRReBiGOcAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left( \\left[\\begin{matrix}1 & 0 & 0 & - \\frac{4}{21}\\\\0 & 1 & 0 & \\frac{1}{63}\\\\0 & 0 & 1 & - \\frac{43}{63}\\\\0 & 0 & 0 & 0\\end{matrix}\\right], \\  \\left( 0, \\  1, \\  2\\right)\\right)$"
      ],
      "text/plain": [
       "⎛⎡1  0  0  -4/21⎤           ⎞\n",
       "⎜⎢              ⎥           ⎟\n",
       "⎜⎢0  1  0  1/63 ⎥           ⎟\n",
       "⎜⎢              ⎥           ⎟\n",
       "⎜⎢         -43  ⎥, (0, 1, 2)⎟\n",
       "⎜⎢0  0  1  ──── ⎥           ⎟\n",
       "⎜⎢          63  ⎥           ⎟\n",
       "⎜⎢              ⎥           ⎟\n",
       "⎝⎣0  0  0    0  ⎦           ⎠"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Arref = A.rref();Arref"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Get the basis of $\\text{Col}A$."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAHkAAABkCAYAAACisp8MAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAJSklEQVR4Ae2db3LUNhjGE6afOyGd6XfCDfhzg+UGdHoCyg3K9AhwA+AEQG6QcAKa3gD6vTOFTC+QPj9H2tV6rbVkr9d6F2lGsS3L0qPn0T9L7zrHR0dHD+Sv5Lvc+c3NzS9dN2pYOQwcHx9/FpqzLkTS7/iH4MYrnRM5dF/Ci3peLAMvO5A9UdhTwkORX0v1KmoHW6UHSbc3bYxq3QQ1It9p34xd66Ez+dfOX+l4IU9XX5wDFziLA7YFkMP8WceTLdEG3QpbcjQBZUx//zIcnxVGF4HYTxR+GX14nhsflO1f82SdnqsT9K2e+Cr/SL5zXE1PsTtmaktG0GdhEhL2ha6v5SG0GCfifi8GTA8QcXhNw5F/rqjveqIPvp0q8kI5fHM1L8yMFnyi8ElqYJhRyrlwMHxQ8fDVOQZSRUbML9S8CHMnkfB9B/8qjBuTkH2DKC2/pDGZLiUCvJl46f7s45/rpk1NtiKc7jw4tSVvZOy6RrppxuZZnRsuGN/qK2CHEoNFVlpMuN6IWBZR5nbPhaN20xEVBomslkO3eClimRXO6oTlNwGo3fQWFbJFdqQeFSIww8WJsNRueovISRMv/7wEZpnsfiiwwiAa0ecgmrwfC0P7XZ0JISt0hPNWMPu8QThmc8kiizCIe9xBGMLPMh4KC692G6ttwvqNcN2PvRXo9vfjkkQWabQYWsWlzsPx71RhD0RmCZOvUDXe20t5dw9xzXKeJLKQITBCM8lpu9nfkT0gVwFZA8YtdH2h40WBlb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hJSNoe3JFV81rRrubgxhLbqOSUqlVAFo55esdjylssshKnOVDEve1iBkeJH5SZs2asc737shbOJhs/aEj+YMxawGfh0p0KtsblYlfL/r5BTCp1Fm/TU4WWRkm/yxj34QJ20aN3zeGqfJT2eiSk7rlGAbzY3KsYDV8xUAVecXFwZ5VkQ9W2lXBqsgrLg72rIp8sNKuChbOrvls0OrO7Rkv4sXOqttgv9dr6caXmM5i5Ufkbb9/nW3dNwa4hncywB5z1P0PErIZsb2RMcUAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}2 & 4 & 1\\\\4 & 2 & -4\\\\2 & -2 & -5\\\\1 & 9 & -3\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡2  4   1 ⎤\n",
       "⎢         ⎥\n",
       "⎢4  2   -4⎥\n",
       "⎢         ⎥\n",
       "⎢2  -2  -5⎥\n",
       "⎢         ⎥\n",
       "⎣1  9   -3⎦"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ColA_basis = A[:,:3];ColA_basis"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Then get the $\\text{Row}A$."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJMAAABMCAYAAABpjYXvAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAJwklEQVR4Ae2d/5HVNhDHOSZ/Z8gxkwKODg6ogKMDSAchHcBQAUM6OKggISWQCoDr4CggMwEmDVy+H53W+Pn03pNtybL9pBmdrR/e1a6/Xkkr6d3R1dXVrRoOWwNHR0efhIP7Y7VwW4ROFa+2xHdjGdTn560BvffnauFpTCtV93ILTpxF+qFF5HfdX7bS3H7upGtyRRoQMM56vuPXAfEfK+8J+W0wncvUVfAEtLXGLAHpjuTCIr2JlU/4uFFXdHjcgel2LKFab3UaeCZw0BslC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GcpMewizJGwiJP181a4TNwJX8JQS1HUvj/vHjrvYyZlJdLBc/7Yy/aus4bBsdlBSzawDEdncNsMazc7eBGkSjRkXxKMJbfOkaABA/MUMbJt2xMFZvPK/ATA2r5N6B7pFJye3vROWGib07QqBt9KK6OaGUB5gBNOjWPX6K7IcwS/JGRsUiB0Cl21QB8Lj/fCld0rO43oV7xSeKyZyasd3crsOI9b9RpnrtGejoY2jcApAXeJyl0m3zny+Vl8SpGWWZxJgpJQy7AetEoDxXKMk7l0xF6Ao0bruIZ97+z5fm1MQw4IfCm957bLjXMok4ZnJfON5XYUh5Sd5D2jv3Z2SlGFxvcw04p+YYGWIskwHFrFCbn1mrGMC1n4u9L8k7to21ntdADJhilMU20FKhJO9SMs+S795uTq026xMSwCwHfqccoSTvHPJE0/RdPOtjfaz+vP8TJtNjCYYSQkJZXmi9J1px2yqW5L2tTVPlI7t4tVf+B7EWnckOacZ2cyUPI5bkPegFHupDMd0cunHnrgJK4suxfceB4iRZJXknEWAuRNTD4LC0IQkOWTezU/6J8kfvZ0LOU8WY5RSWTrrLKZMcwhTfYrylcFuGwP+yuOWUVvtZDkp+SFM0m+WUWMukZ1z/XeQQZkne+mqxjIwNHygSpvwPoNccR/71Fin7Ic16CHPki1rC4wJTtkOaou286gz0YwfgS9BZbWNAA3rZWFWiHTjIdkizginwAlaWZb7A7Ic0K5hWhpyuOOp+zAdoVyYU+LAIZ9eX73992aBDmhVM3/W45juAdBIQMOkhzTaYLtW/XnUiM5kalq8B/Es2ZrItyL0PaQobNzAiuuxCdQHXAKjlX0mEQmMaQ4U1bxkaUNfV95DmQ0kW2s/kdmluk/p/Kmzzj6rZ2ZsAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0 & - \\frac{4}{21}\\\\0 & 1 & 0 & \\frac{1}{63}\\\\0 & 0 & 1 & - \\frac{43}{63}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡1  0  0  -4/21⎤\n",
       "⎢              ⎥\n",
       "⎢0  1  0  1/63 ⎥\n",
       "⎢              ⎥\n",
       "⎢         -43  ⎥\n",
       "⎢0  0  1  ──── ⎥\n",
       "⎣          63  ⎦"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "RowA_basis = Arref[0][0:3,:];RowA_basis"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Multiply $CR$, we are getting back $A$."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAKgAAABkCAYAAAASYXt7AAAACXBIWXMAAA7EAAAOxAGVKw4bAAALS0lEQVR4Ae2d75HVNhTFd5l8zsBmJt9ZOoBsB0sHZFIBoQOYlAAdQCog0AFQAVk6WArITGAnDWzOz0jGz8/eJ9vy85Xf1YyfbfmPzj06lq5sSe/46OjovpYLLV3h7fX19a9dBzzOGcjBwPHx8aXuc9p1L2nv+IfGgRfa5uRm+Nzc8W1nYAYGnnfc86HiHhHfFOhLKdYF2cGWR83HgDT3qn13lapEVQK91T7Yt6+LTrW8DMuF1u+04B6YC+ACpzlgNwAKmC+1vn3DacUeGmtfswTtNV43x0d43vRHFUfRjFAfKv5978XLHHijZD8tk3R6quIOMf6p5YuWX7R0+mKKLzLksC+1BEWMj5ssSZTPtH+lBTGYCSLlqRkwO4CIwyseei1PdOrrHacXdziHfakCPRc7X8MT0SSKkvO24k08+cKBy8FDw+JhBQykChQhfuaJ6LH5dk/8vqN/E8Ytp3vfIDy9fAwk+aDK9L53oVUjSccX9/dC1V5UwyhfNq73Tqkl6BYDoTqlascXXTQEFwN/zl+TLZoT+RMfLVBBoXH0SqLgBf/S4YlweNW+dC7MkH5SFd9OVyUWVel7iYLW56JBWH4XAK/aZ8gFcUvb4oOWIW0M3kpkc/kGCzQI4siIOHExbguLV+0zCFS80ih+MMOtk285SKASJ5+f7jXFq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\begin{matrix}2 & 4 & 1 & -1\\\\4 & 2 & -4 & 2\\\\2 & -2 & -5 & 3\\\\1 & 9 & -3 & 2\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡2  4   1   -1⎤\n",
       "⎢             ⎥\n",
       "⎢4  2   -4  2 ⎥\n",
       "⎢             ⎥\n",
       "⎢2  -2  -5  3 ⎥\n",
       "⎢             ⎥\n",
       "⎣1  9   -3  2 ⎦"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ColA_basis*RowA_basis"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Verify if $CR$ equals $A$."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ColA_basis*RowA_basis == A"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
